Numpy y pandas problem import

When I try to import numpy and pandas I get this error

Traceback (most recent call last):
File “C:\Users\XXX\Documents\Python\”, line 1, in
import numpy
File “C:\Users\XXX\Documents\Python\”, line 2, in
import pandas
File “C:\Users\XXX\AppData\Local\Programs\Python\Python310\lib\site-packages\”, line 22, in
from pandas.compat import is_numpy_dev as is_numpy_dev
File "C:\UsersXXX\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\compat_init
.py", line 13, in
from pandas._typing import F
File “C:\Users\XXX\AppData\Local\Programs\Python\Python310\lib\site-packages\”, line 78, in
ArrayLike = Union[“ExtensionArray”, np.ndarray]
AttributeError: partially initialized module ‘numpy’ has no attribute ‘ndarray’ (most likely due to a circular import)

Hi Barry,

sooner or later most people new to Python make this mistake: don’t call your script - what you’re seeing here is Python importing your when you write import numpy, rather than the “real” numpy.


Thanks, changed name of file testing numpy and pandas and now it works.