'utf-8' codec can't decode byte 0xa0 in position 121: invalid start byte

Question:

How do I resolve this issue? Thank you.

from google.colab import drive
drive.mount('/content/drive')
path = "/content/drive/MyDrive/Colab Notebooks/Meteo.csv"

Meteo = pd.read_csv(path, parse_dates=[['Date', 'Time']])
Meteo.head()

Sample of CSV

I’m looking for help to fix the error because I cannot get the output display yet.

Asked By: Ili

||

Answers:

Use encoding='latin-1

df = pd.read_csv('Meteo.csv', encoding='latin-1', parse_dates=[['DATE', 'TIME']])
print(df)

            DATE_TIME TEMPERATURE DEW POINT HUMIDITY WIND WIND SPEED WIND GUST  PRESSURE PRECIPITATION CONDITION
0 2022-01-01 00:00:00       77 °F     72 °F     83 %  VAR      2 mph     0 mph  29.79 in        0.0 in      Fair
1 2022-01-01 01:00:00       75 °F     72 °F     89 %  VAR      1 mph     0 mph  29.79 in        0.0 in      Fair
2 2022-01-01 02:00:00       75 °F     72 °F     89 %    N      3 mph     0 mph  29.79 in        0.0 in      Fair
3 2022-01-01 03:00:00       75 °F     72 °F     89 %    N      3 mph     0 mph  29.76 in        0.0 in      Fair
4 2022-01-01 04:00:00       75 °F     72 °F     89 %  VAR      3 mph     0 mph  29.76 in        0.0 in      Fair
Answered By: NYC Coder
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.