Fisher's exact test from scipy import stats oddsratio, pvalue = stats.fisher_exact([[A,B], [C, D]]) [1]