UnicodeDecodeError: "utf-8" codec can't decode byte in position : invalid start byte

+1 vote

While I importing the file it shows

UnicodeDecodeError: "utf-8" codec can"t decode byte 0xa0 in position 10: invalid start byte


import pandas as pd
a = pd.read_csv("filename.csv")
Jul 23, 2019 in Python by Hari

1 answer to this question.

+2 votes
Best answer

You have to use the encoding as latin1 to read this file as there are some special character in this file, use the below code snippet to read the file,

import pandas as pd


answered Jul 23, 2019 by Kunal

selected Dec 24, 2019 by Kalgi
Thanks Kunal you are awesome
Please upvote the answer if its useful :)
Thank you so much, it is helpful answer, I also have same problem but solved
you are great dude!
Hey! Please do register at Edureka Community and upvote the answer if it has helped you.


Related Questions In Python

+1 vote
1 answer

(unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

You are getting this error because you ...READ MORE

answered Dec 31, 2019 in Python by Kalgi
• 50,110 points
0 votes
2 answers

Error: Speech to Text Codec cannot decode the bytes in position

import speech_recognition as sr r = sr.Recognizer() audio ='C\Users\Desktop\audiofile1.wav' with ...READ MORE

answered Nov 27, 2018 in Python by Nabarupa Das
0 votes
2 answers

Python Error "UnicodeEncodeError: 'ascii' codec can't encode character u'\u03b1' in position 20: ordinal not in range(128)"

import csv import sys reload(sys) sys.setdefaultencoding('utf8') data = [["a", "b", u'\xe9']] with ...READ MORE

answered Jun 28, 2019 in Python by anonymous
0 votes
1 answer

Writing unit tests in Python: How do I start?

If you're brand new to using unittests, ...READ MORE

answered Sep 18, 2018 in Python by Priyaj
• 57,490 points
0 votes
1 answer
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 533 views
0 votes
0 answers
+4 votes
6 answers
+1 vote
1 answer
0 votes
1 answer