Home > Enterprise >  Pandas read_csv UnicodeDecodeError: invalid start byte
Pandas read_csv UnicodeDecodeError: invalid start byte

Time:04-22

I am trying to read a .csv file using pandas but get this error.

Line of code: pd.read_csv(r"C:\Users\antba\Desktop\ffstats.csv")

Error message: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 85: invalid start byte

I've removed the 'r' from the pd.read_csv command but was met with a different error message. Any help would be appreciated, thank you.

CodePudding user response:

Okay, this might be due to encoding. Second Please try google before asking questions on StackOverflow it will help to learn more things.

The reason for your problem is encoding if you know the encoding of CSV try something like this.

pd.read_csv('your_file.csv', encoding = 'ISO-8859-1')
  • Related