Jonivictor
Jonivictor

Reputation: 41

Fail to rename columns because of character-encoding symbols

I have a dataframe encoded in latin-1 and i want to rename a series of columns:

df=df.rename(columns={"DATE (YYYY-MM-DD)": 'local time',"AIR TEMP - DRY BULB HOURLY (°C)": 'air temp mean'...})

All other columns except of "AIR TEMP - DRY BULB HOURLY (°C)" and other column who has the superscript two symbol got their names changed and I think these last ones failed because of their symbols.

How can I solve this problem ?

Upvotes: 0

Views: 132

Answers (1)

SwissCodeMen
SwissCodeMen

Reputation: 4885

Try it with °C and set the charset to utf-8.

Or look at this question, possible dublicate How to get ° character in a string in python?

Upvotes: 1

Related Questions