I wrote the following simple code to invoke pd.DataFrame()
.
import pandas as pd df=pd.DataFrame()
And, it is throwing the following error message:
Traceback (most recent call last):
File "./pandas.py", line 2, in
import pandas as pd
File "/media/master/github/python/pandas.py", line 4, in
df=pd.DataFrame()
AttributeError: module 'pandas' has no attribute 'DataFrame'
This drove me crazy. The code that I wrote was perfectly correct.
Solution
It turns out. I put my code in pandas.py and run it from that file. It messed up the import, resulting in this error.
Avoid calling your script pandas.py or pd.py