Unicode Datas Of A Dataframe To Strings
I have some troubles with a dataframe obtained from reading a xls file. Every data on such dataframe has the type 'unicode' and I can't do anything with this. I wanna change it to
Solution 1:
You can use the following code.
forcolumnin df:
df[column] = df_peru[column].str.encode('utf-8')
Solution 2:
To help others, this version worked for me.
I was getting an error while loading my dataframe to an oracle database: "UnicodeDecodeError: 'ascii' codec can't decode byte 0xea in position 2: ordinal not in range(128)
"
I am on Python ver 2.7
for column indf:
df[column]= df[column].astype(str).str.decode('utf-8')
Post a Comment for "Unicode Datas Of A Dataframe To Strings"