python scipy stats module:ValueError:'axis'条目超出范围

时间:2013-10-23 17:49:46

标签: python scipy

我正在使用scipy的统计数据来计算Fisher的精确测试分数。 它工作得很好,除了一些矩阵,它返回valueError。 例如,

odds, pvalue = stats.fisher_exact([[1,2],[9,84419233]])

返回

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/scipy-0.14.0.dev_4938da3-py2.7-macosx-10.8-x86_64.egg/scipy/stats/stats.py", line 2606, in fisher_exact
    if float(np.abs(pexact - pmode)) / np.abs(np.max(pexact, pmode)) <= 1 - epsilon:
  File "/Library/Python/2.7/site-packages/numpy-1.9.0.dev_fde3dee-py2.7-macosx-10.8-x86_64.egg/numpy/core/fromnumeric.py", line 2126, in amax
    return amax(axis=axis, out=out)
  File "/Library/Python/2.7/site-packages/numpy-1.9.0.dev_fde3dee-py2.7-macosx-10.8-x86_64.egg/numpy/core/_methods.py", line 17, in _amax
    out=out, keepdims=keepdims)
ValueError: 'axis' entry is out of bounds

我不知道为什么这不起作用..

有人可以帮帮我吗?

1 个答案:

答案 0 :(得分:1)

这是fisher_exact函数中的错误。我在这里报告了这个问题:https://github.com/scipy/scipy/issues/3014