I have a pandas dataframe with two columns: ['exposure', 'outcome']. both are bool columns. Sample data: exposure outcome 1 False True 5 True False 7 False False 11 False False 21 True False 13 False False 1 False True 24 False False 15 False False 16 False False 31 False False 5 True True 1 True False 13 True True 40 False False 1 True False Now when I create a Crosstable table using pandas.crosstab i get the following: contingency_table = pd.crosstab(data['exposure'], data['outcome']) outcome False True exposure False 12 4 True 20 12 then when doing: from scipy.stats import fisher_exact oddsratio, pvalue = fisher_exact(contingency_table.values) I get the wrong odds ratio (1.8 here) because the order of the crosstab table is wrong. The OR should be 0.55 when I calculate that manually. What am I missing here? Continue reading...