如何避免UnicodeDecodeError读取此csv文件?

2024-06-16 14:33:05 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个csv文件,包含以下数据:

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')

它给了我以下的错误。我使用的是python3.6。请帮忙。你知道吗

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

Tags: 文件csv数据textreworldvaluebyte