Home > Software design >  Problem importing txt file data with pandas
Problem importing txt file data with pandas

Time:04-07

df = pd.read_csv("AVG.txt")
df

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

I'm a beginner i'm trying to interpret some data with python and i ran into this error trying to load the file

This is the file I am trying to upload: File

CodePudding user response:

This is probably an encoding issue, try

df = pd.read_csv("AVG.txt",encoding="utf-16")

You may also try using the basic open() function and parse it later on

CodePudding user response:

The file is a .txt file. If you save it as a .csv should work fine (e.g. copy into Excel and use Save As). Just tried it and its worked.

  • Related