Hello Guys, How are you all? Hope You all Are Fine. Today I am just trying to read csv file But I am facing following error UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 35: invalid start byte in python. So Here I am Explain to you all the possible solutions here.
Without wasting your time, Let’s start This Article to Solve This Error.
- How UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 35: invalid start byte Error Occurs ?
- How To Solve UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 35: invalid start byte Error ?
- Solution 1: Use encoding cp1252
- Solution 2: Ignore errors
- Solution 3: Use encoding=”ISO-8859-1″
- Summary
How UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 35: invalid start byte Error Occurs ?
I am just trying to read csv file But I am facing following error.
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 35: invalid start byte
How To Solve UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 35: invalid start byte Error ?
How To Solve UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 35: invalid start byte Error ?
To Solve UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 35: invalid start byte Error Just Use encoding cp1252 and your error will be solved. Use below example: encoding=’cp1252′. Second solution is Use this solution and it will ignore errors and third solution is Just use encoding=”ISO-8859-1″.
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 35: invalid start byte
To Solve UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 35: invalid start byte Error Just Use encoding cp1252 and your error will be solved. Use below example: encoding=’cp1252′. Second solution is Use this solution and it will ignore errors and third solution is Just use encoding=”ISO-8859-1″.
Solution 1: Use encoding cp1252
Just Use encoding cp1252 and your error will be solved. Use below example.
Past=pd.read_csv("C:/Users/.../Past.csv",encoding='cp1252')
Solution 2: Ignore errors
Use this solution and it will ignore errors.
with open(path, encoding="utf8", errors='ignore') as f:
Solution 3: Use encoding=”ISO-8859-1″
Just use encoding=”ISO-8859-1″. Here is example.
pd.read_csv("Your filename", encoding="ISO-8859-1")
Summary
It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?
Also, Read