Is Pandas Not Importing? 'nameerror: Global Name 'pandas' Is Not Defined'
I'm getting a few errors here but I think it's due to pandas not importing as it's greyed out. If that is the problem, how would I fix this? C:\Anaconda\python.exe C:/Users/nick
Solution 1:
You have imported it as
import pandas as pd
and calling
#pandasdf = pandas.DataFrame(columns = ['Date','Unix','Ticker','DE Ratio'])
You could either change
import pandas as pd
toimport pandas
ordf = pandas.DataFrame(columns = ['Date','Unix','Ticker','DE Ratio'])
todf = pd.DataFrame(columns = ['Date','Unix','Ticker','DE Ratio'])
.
edit:
error is due to missing )
save = gather.replace(' ','').replace(')','').replace('(','').replace('/',''+('.csv'))
Solution 2:
You imported pandas as pd
. Either refer to it as such throughout, or remove the as pd
from the import.
(Plus, never ever ever do except Exception... pass
. You'll swallow all sorts of errors and never know what they were. If you aren't going to handle them, don't catch them at all.)
Post a Comment for "Is Pandas Not Importing? 'nameerror: Global Name 'pandas' Is Not Defined'"