当Python中有两个以上的组时,如何执行精确的Fisher测试?

当Python中有两个以上的组时,如何执行精确的Fisher测试?,python,statistical-test,Python,Statistical Test,我的数据如下: prfs ex F M Pref C 11 20 B 15 6 A 3 5 我想做一个精确的费希尔测试。scipy中有一个函数,但只接受2x2列联表: stats.fisher_exact(prfs, alternative = 'two-sided') ValueError: The input `table` must be of shape (2, 2). 在R中有一个函数正是这样做的,但是在Python中呢? 在R中: sci

我的数据如下:

prfs
ex  F   M
Pref        
C   11  20
B   15  6
A   3   5
我想做一个精确的费希尔测试。scipy中有一个函数,但只接受2x2列联表:

stats.fisher_exact(prfs, alternative = 'two-sided')
ValueError: The input `table` must be of shape (2, 2).
在R中有一个函数正是这样做的,但是在Python中呢? 在R中:


scipy.stats.chi2_contractive()是最接近的

fisher.test(prfs)
Fisher's Exact Test for Count Data

data:  prfs
p-value = 0.03261
alternative hypothesis: two.sided