UnicodeDecodeError on csv file - Stack Overflow

admin2025-04-17  2

UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 606-607: invalid continuation byte

show and run the program \

he UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 606-607: invalid continuation byte error typically happens when you try to decode a byte sequence that isn't valid UTF-8. This can occur when you're reading a file or receiving data that includes characters or byte sequences not properly encoded in UTF-8.

UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 606-607: invalid continuation byte

show and run the program \

he UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 606-607: invalid continuation byte error typically happens when you try to decode a byte sequence that isn't valid UTF-8. This can occur when you're reading a file or receiving data that includes characters or byte sequences not properly encoded in UTF-8.

Share Improve this question asked Jan 31 at 6:00 Subhankar RoutSubhankar Rout 1 2
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Bot Commented Jan 31 at 6:51
  • The CSV is clearly not encoded with UTF-8; but IDK how you can specify an other encoding with opencsv – Fravadona Commented Jan 31 at 8:39
Add a comment  | 

1 Answer 1

Reset to default 0
import pandas as pd

# Try reading the CSV file with 'latin1' or 'ISO-8859-1' encoding
df = pd.read_csv('yourfile.csv', encoding='latin1')

# If latin1 doesn't work, try cp1252 (another common encoding)
# df = pd.read_csv('yourfile.csv', encoding='cp1252')
转载请注明原文地址:http://anycun.com/QandA/1744878661a88909.html