2017-10-16 182 views
0

我有一个数据的csv文件如下:无法读取csv文件在python

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 

,当我读到的CSV文件

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

它给了我下面的错误。我正在使用python 3.6。请帮忙。

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x85 in position 33: invalid start byte 
+0

您的文件不是用UTF-8编码。你需要找出实际的编码是什么。或者尝试猜测(例如cp1252),看看会发生什么。 ;) –

回答

2

尝试

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

df=pd.read_csv('Book1.csv',dtype='unicode',encoding = "ISO-8859-1")