python - "Import Error: cannot import name 'unicode_literals' " -
sorry if dumb question i'm trying import , open csv using pandas in python. whenever hit run syntax error "cannot import name 'unicode_literals'". have no idea why happening , haven't been able find source online details error means.
this code:
import pandas pd open(r"filepath\file.csv") rawdata: pd.read_csv(rawdata)
here error:
c:\anaconda3\python.exe "filepath" traceback (most recent call last): file "filepath/main.py", line 1, in <module> import pandas pd file "c:\anaconda3\lib\site-packages\pandas\__init__.py", line 7, in <module> . import hashtable, tslib, lib file "pandas\src\numpy.pxd", line 157, in init pandas.hashtable (pandas\hashtable.c:22997) file "c:\anaconda3\lib\site-packages\numpy\__init__.py", line 107, in <module> __future__ import division, absolute_import, print_function file "c:\anaconda3\lib\__future__.py", line 23, in <module> __future__ import unicode_literals importerror: cannot import name 'unicode_literals' cannot import name 'unicode_literals'
any suggestions why isn't working appreciated.
you're on right track! thing have add parameter open(). yield:
import pandas pd open(r"filepath\file.csv", encoding='utf-8') rawdata: pd.read_csv(rawdata)
Comments
Post a Comment