0

I have a csv file with data as below:

Text                                                        Value
RT @AmericanHot We're DONE! . htt…                           A
RT @votevets: Hertha Berlin German #Bundesliga world.…  
RT @votevets: Hertha Berlin players  # world.…               B
RT @HerthaBSC_EN: Hertha BSC stands forever…    
RT @johanbakerr: There's no anthem played                    D

when I read the csv file as

df = pd.read_csv('Book1.csv')

It gives me below error. I am using python 3.6. Please help.

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x85 in position 33: invalid start byte
2
  • Your file isn't encoded with UTF-8. You need to find out what the actual encoding is. Or try guessing (eg cp1252) & see what happens. ;) Commented Oct 16, 2017 at 4:48
  • This question is similar to: UnicodeDecodeError when reading CSV file in Pandas. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. Commented Sep 24 at 11:09

1 Answer 1

1

try

 df=pd.read_csv('Book1.csv',dtype='unicode')

or

  df=pd.read_csv('Book1.csv',dtype='unicode',encoding = "ISO-8859-1")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.