pandas 读取Excel 报错UnicodeDecodeError: ‘ascii‘ codec can‘t decode byte 0xd3 in position 0: ordinal not

Pandas 读取Excel文件时报错:UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xd3 in position 0: ordinal not in range(128)

这个主要时Excel编码问题,网上很多人说,使用Excel另存为 在保存一份新的文件,其实没有必要使用下面代码即刻:

pd.read_excel(xlrd.open_workbook(file_path, encoding_override="gbk"), header=5)

使用xlrd 加载excel并指定编码,即可解决问题

猜你喜欢

转载自blog.csdn.net/afgasdg/article/details/114014858