'utf-8' codec can't decode byte 0xc1 in position 0: invalid start byte
fdata = pd.read_csv(fpath,encoding='gb18030')
可以尝试多种格式,比如:encoding=‘gbk’ 或者encoding='ISO-8859-1’等
使用Python的chartdet包先识别文件的类型,再定义encoding的值
import chardet
def guess_encoding(file_path):
with open(file_path, 'rb') as f:
result = chardet.detect(f.read())
return result['encoding']
读取表格文件时,报错
ValueError: Value must be either numerical or a string containing a wildcard