pandas read_csv UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 0: invalid continuation byte
import chardet
with open('data.xlsx', 'rb') as f:
result = chardet.detect(f.read()) # 读取并检测编码
print(result)
print(result['encoding']) # 打印检测到的编码
{'encoding': None, 'confidence': 0.0, 'language': None}
None
按照下面的方式:改一下csv的文件编码 ok


浙公网安备 33010602011771号