python scipy 统计模块 : ValueError: 'axis' entry is out of bounds

标签 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

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

有人可以帮我吗?

最佳答案

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

关于python scipy 统计模块 : ValueError: 'axis' entry is out of bounds,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19548854/

相关文章:

python - 在 Python 类中多次使用 super()

python - 用于多个客户端的扭曲服务器

python - 为什么设置 remember=False 仍然让我保持登录状态?

python - 使用 numpy.fft VS 计算信号 PSD 的前置因素。 scipy.signal.welch

python - 按索引位置从稀疏数据框中选择行

python - MATLAB 中是否有等效的 Python 范围函数?

Python - 使用 for 循环构造集

python - python scipy 中样条线与平面的相交

python - Wolfram Alpha 和 scipy.integrate.quad 对同一个积分给出了不同的答案

python - 面向 MATLAB 程序员的 Python 科学计算