我的Jupyter Notebook崩溃了,所以我需要重新安装它,但在新的Jupyter Notebook中,我无法运行pandas。
import pandas as pd
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_6860/4080736814.py in <module>
----> 1 import pandas as pd
~\anaconda3\lib\site-packages\pandas\__init__.py in <module>
20
21 # numpy compat
---> 22 from pandas.compat import (
23 np_version_under1p18 as _np_version_under1p18,
24 is_numpy_dev as _is_numpy_dev,
~\anaconda3\lib\site-packages\pandas\compat\__init__.py in <module>
12 import warnings
13
---> 14 from pandas._typing import F
15 from pandas.compat.numpy import (
16 is_numpy_dev,
~\anaconda3\lib\site-packages\pandas\_typing.py in <module>
82 # array-like
83
---> 84 ArrayLike = Union["ExtensionArray", np.ndarray]
85 AnyArrayLike = Union[ArrayLike, "Index", "Series"]
86
AttributeError: module 'numpy' has no attribute 'ndarray'
我尝试重命名或删除numpy.py文件,但这并没有起作用。
pip uninstall -y numpy
然后执行pip install numpy
。 - garagnoth