Python Pandas Read_excel Returns Unicodedecodeerror On Describe()
I love pandas, but I am having real problems with Unicode errors. read_excel() returns the dreaded Unicode error: import pandas as pd df=pd.read_excel('tmp.xlsx',encoding='utf-8')
Solution 1:
Try this method suggested here:
df=pd.read_excel('tmp.xlsx',encoding=sys.getfilesystemencoding())
Solution 2:
Hope this helps someone.
I had this error:
UnicodeDecodeError:'ascii' codec can't decode byte ....
after reading an Excel File df = pd.read_excel...
and trying to assign a new column to the dataframe like this df['new_col'] = 'foo bar'
After closer inspection, I found the problem to be. There were some 'nan'
columns in the dataframe due to missing column headers. After dropping the 'nan' columns using the following code, everything else was ok.
df = df.dropna(axis=1,how='all')
Post a Comment for "Python Pandas Read_excel Returns Unicodedecodeerror On Describe()"