'module' object has no attribute 'DataFrame'

Change the file name if your file name is like pandas.py or pd.py, as, otherwise, the file name will shadow the real name. In this case, an error message may also be raised, citing a possible circular import.


The code presented here doesn't show this discrepancy, but sometimes I get stuck when invoking dataframe in all lower case.

Switching to camel-case (pd.DataFrame()) cleans up the problem.


Please check if:

a) you've named a file 'pandas.py' in the same directory as your script, or

b) another variable called 'pd' is used in your program.