在调试中,在从 Scipy 导入之前使用 pandas 会在导入时生成类型错误

2023-12-29

在 Mac 上的 PyCharm 2021.3(社区版)中调试运行时,代码:

import pandas as pd
x = pd.DataFrame()
from scipy.stats import poisson

生成异常:

...
  File "/.../venv/lib/python3.10/site-packages/numpy/core/getlimits.py", line 518, in __init__
    self.dtype = numeric.dtype(type(int_type))
TypeError: 'NoneType' object is not callable

(the None变量是numeric.dtype)

Python 3.10.0
依赖项:pip install numpy==1.21.2 pandas==1.3.5 scipy==1.7.3


这是一个已知(但尚未解决)的问题;看熊猫问题 41935 https://github.com/pandas-dev/pandas/issues/41935在 github 上。那里的一些评论表明它可能是 Python 或Cython 错误 https://github.com/cython/cython/issues/4609.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在调试中,在从 Scipy 导入之前使用 pandas 会在导入时生成类型错误 的相关文章

随机推荐