Skip to content
Advertisement

module ‘numpy’ has no attribute ‘dtype’

When importing sklearn datasets eg.

JavaScript

I get the error

JavaScript

I am not sure why I get this

I don’t get this error when running things from a jupyter notebook, which is also weird. Any help on this issue would be greatly appreciated

Advertisement

Answer

I figured this out. The answer is that the file I was running was named numbers.py. This screws the whole thing up. If you have this problem check to make sure you don’t have a file in the directory called numbers.py

Easy way to check is move the file with the import statement to a different directory and try running it.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement