0

I have a TSV file enter image description here

I am trying to convert this TSV file to CSV like:

df = pd.read_table(f'downloads/Survey.tsv',sep='\t+', header=None)
print(df)

It is giving me following error: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

Avenger
  • 793
  • 11
  • 31
  • Which encoding is your tvs file? UTF-16? Note: just to convert it, do not use pandas, but just read the file, escape every comma, substitute tabulator character with comma and save. Else you may have to deal with converting twice dates and times (etc.), which often fives problems – Giacomo Catenazzi Jun 09 '23 at 11:21
  • 2
    You are a having a problem with the encoding. I would recommend you to find what encoding you are using and use it on your pandas reading (try adding , encoding="utf-8"). Also, instead of reading through pd.read_table, it would be fine to use read_csv. – murgado Jun 09 '23 at 11:21
  • 1
    Check out : https://stackoverflow.com/questions/42339876/error-unicodedecodeerror-utf-8-codec-cant-decode-byte-0xff-in-position-0-in – JonSG Jun 09 '23 at 13:37

0 Answers0