Reputation: 299
I am using Pandas to import some csv file into Python.
my code is:
import pandas as pd
data_df = pd.read_csv('highfrequency2.csv')
print data_df.head()
but there is always an error message:
**Traceback (most recent call last):
File "G:\Python\sdfasdfasdfasdfasdf.py", line 7, in <module>
import pandas as pd
File "G:\Python\pandas.py", line 9, in <module>
from pandas import DataFrame
ImportError: cannot import name DataFrame**
Can some one figure out why ? Many thanks !!!
Upvotes: 0
Views: 1056
Reputation: 353459
It look like you've called one of your own programs pandas
:
G:\Python\pandas.py
So this is the one Python is trying to import, and the one which doesn't have a DataFrame object.
Rename your program, delete any cached objects (pandas.pyc
or pandas.pyo
), and restart your Python interpreter.
Upvotes: 3