Today We are Going To Solve UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0xe9 in position 10: invalid continuation byte in Python. Here we will Discuss All Possible Solutions and How this error Occurs So let’s get started with this Article.
Contents
How to Fix UnicodeDecodeError: ‘utf8’ codec can’t decode byte 0xe9 in position 10: invalid continuation byte Error?
- How to Fix UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 10: invalid continuation byte Error?
To Fix UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 10: invalid continuation byte Error just Change the encoding to
latin-1
. Here you have to change the encoding tolatin-1
. You can see this in below command.pd.read_csv('ml-100k/u.item', sep='|', names=m_cols , encoding='latin-1')
- UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 10: invalid continuation byte
To Fix UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 10: invalid continuation byte Error just Check the file. Here you have to check if you're manipulating a file that was just opened in 'rb' mode. Just make sure about it.
Solution 1 : Change the encoding to latin-1
Here you have to change the encoding to latin-1
. You can see this in below command.
pd.read_csv('ml-100k/u.item', sep='|', names=m_cols , encoding='latin-1')
Solution 2 : Check the file
Here you have to check if you’re manipulating a file that was just opened in ‘rb’ mode. Just make sure about it.
Solution 3 : Run the command
If the error is UTF-8. Then just use the given below command to solve it.
pd.read_csv('File_name.csv',encoding='latin-1')
Solution 4 : Save file as a UTF-8
encoding
To solve the error you have t just click on file -> save as
and I saved this file as a UTF-8
encoding and your error will be solved.
Conclusion
So these were all possible solutions to this error. I hope your error has been solved by this article. In the comments, tell us which solution worked? If you liked our article, please share it on your social media and comment on your suggestions. Thank you.
Also Read These Solutions
- Failed to download metadata for repo ‘appstream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist
- How to downgrade python version from 3.9 to 3.8
- ImportError: No module named ‘yaml’
- Fatal error in launcher: Unable to create process using ‘”‘
- ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory