I have been trying to upload a csv file using pandas .read() function. But as you can see from my title this is what I get "'utf-8' codec can't decode byte 0x92 in position 16: invalid start byte" And it's weird because from the same folder I was able to upload a different csv file without problems. Something that might have caused this is that the file was previously xlsx and I manually converted it to cvs? Please Help Python3
Asked
Active
Viewed 699 times
2
-
Never mind, I solved it by adding this pd.read_csv("filename.csv",encoding="Latin-1") – Stef Feb 12 '18 at 19:56
-
Does this answer your question? ['utf-8' codec can't decode byte 0x92 in position 18: invalid start byte](https://stackoverflow.com/questions/46000191/utf-8-codec-cant-decode-byte-0x92-in-position-18-invalid-start-byte) – Henry Ecker Jul 14 '22 at 05:41
1 Answers
0
Try the below:
pd.read_csv("filepath",encoding='cp1252').
This one should work as it worked for me.

Shins
- 33
- 1
- 7
-
This is not really a solution. What encoding you pick depends on the encoding of the file. – Azsgy Mar 27 '18 at 14:31
-
1Ok. So how do you find the encoding of the file so that I may pick the respective encoding? – Shins Mar 27 '18 at 15:10
-
Well, this is a hard problem. It boils down to just guessing. Libraries like `chardet` can help with that. – Azsgy Mar 27 '18 at 15:16