Data Science Asked by HonzaB on August 18, 2021
I have DataFrame which has column with spanish regions, when I import the .csv as following
df = pd.read_csv('...',delimiter=';',decimal=',')
And print the content of column, I see this: Castilla y Le�n.
I could not find a way how to fix it, but I am assuming there is smart way how to do it.
read_csv
has an optional argument called encoding
that deals with the way your characters are encoded.
You can give a try to:
df = pandas.read_csv('...', delimiter = ';', decimal = ',', encoding = 'utf-8')
Otherwise, you have to check how your characters are encoded (It is one of them).
You can read the doc of read_csv
here
Answered by Igor OA on August 18, 2021
Answered by renakre on August 18, 2021
Answered by sanwall on August 18, 2021
I have a Spanish dataframe and I use the latin-1
encoding.
df = pd.read_csv('...', delimiter = ';', decimal = ',', encoding = 'latin-1')
Answered by Hans David Santiago Villabon on August 18, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP