在提取一个后缀为xls的excel文件时,突然报错:
Message=‘utf-16-le’ codec can’t decode bytes in position 2-3: unexpected end of data
Source=C:\Users\数据清洗.py
StackTrace:
File “C:\Users\Desktop数据清洗.py”, line 113, in file
data = xlrd.open_workbook(inpath, encoding_override=‘utf-8’)
解决方法:
将xls文件另存为xlsx文件,即可顺利读取。