【pandas问题】UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xca in position 0: invalid continuati

出错位置:

data = pd.read_csv('../data/user.csv')
print(data.head())

报错信息:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xca in position 0: invalid continuation byte

解决:
将编码方式改为GBK(专门为解决汉字的编码而生成的解决方案),如下所示:

data = pd.read_csv('../data/user.csv', encoding='gbk')
print(data.head())

你可能感兴趣的:(各路问题汇总,pandas,python,numpy)