Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aus10powell/c142369842b08cd78408678597ba0ed9 to your computer and use it in GitHub Desktop.
Save aus10powell/c142369842b08cd78408678597ba0ed9 to your computer and use it in GitHub Desktop.
Pandas Odds-Ratio Display and Test
#####################
# 2x2 Contingency table w/ test
#####################
import stats
d = {
"flagged": [221, 221],
"not-flagged": [2,10],
}
d_t = pd.DataFrame(d, index=["English", "Non-English"])
display(d_t)
oddsratio, pvalue = stats.fisher_exact(d_t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment