NeradLeo
0
Q:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 2892: invalid continuation byte

import pandas as pd
data = pd.read_csv(filename, encoding= 'unicode_escape')
5
pd.read_csv('ml-100k/u.item', sep='|', names=m_cols , encoding='latin-1')
7
# Use 'ISO-8859-1' instead of "utf-8" for decoding
text = open(fn, 'rb').read().decode('ISO-8859-1')
2
with open(file, newline='', encoding="utf16") as MyFile:
3
As suggested by Mark Ransom, I found the right encoding for that problem.
The encoding was "ISO-8859-1", so replacing

open("u.item", encoding="utf-8")
with
open('u.item', encoding = "ISO-8859-1")

will solve the problem.
1
pd.read_csv("C:/Users/Admin/Desktop/Python/Past.csv",encoding='cp1252')
0
#use rb over r
with open(path, 'rb') as f:
  text = f.read()
0

New to Communities?

Join the community