简体   繁体   中英

I tried importing Pandas as pd in Jupyter notebook and got “AttributeError: module 'numpy' has no attribute 'ndarray'”


AttributeError Traceback (most recent call last) in ----> 1 import pandas as pd

~\\anaconda3\\lib\\site-packages\\pandas_ init _.py in 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 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 82 # array-like 83 ---> 84 ArrayLike = Union["ExtensionArray", np.ndarray] 85 AnyArrayLike = Union[ArrayLike, "Index", "Series"] 86

AttributeError: module 'numpy' has no attribute 'ndarray'

In jupyter notebook, try uninstalling the numpy library using

! pip uninstall numpy

and then reinstalling the numpy

! pip install numpy

This is most likely an issue with your numpy library version and reinstalling will fix that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM