The following code executed from the IDLE window causes the error shown below.
import numpy as np testarray = np.array([1,2,3], int)
Here is the mistake ...
Traceback (most recent call last): File "C:\Test\numpy.py", line 1, in <module> import numpy as np File "C:\Test\numpy.py", line 2, in <module> testarray = np.array([1,2,3], int) AttributeError: 'module' object has no attribute 'array' >>>
If I do the same in the shell, it works fine ...
>>> import numpy as np >>> testarray = np.array([1,2,3], int) >>> testarray array([1, 2, 3]) >>>
It keeps me all day ... does anyone know how to fix this? Maybe I'm doing something wrong.
Note. If I just executed the code above without testarray, the error will not be returned.
source share