UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 1: invalid start byte解决方案

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 1: invalid start byte
import pandas as pd
f = open('cus_loss.csv',encoding="utf-8")
# f = open('cus_loss.csv')
cus_loss = pd.read_csv(f)
得到这个错误
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 1: invalid start byte

添加如下代码:

import sys
reload(sys)
sys.setdefaultencoding("utf-8")

然后,又有这个错误

NameError: name 'reload' is not defined

 

参考文献:

https://blog.csdn.net/daijiguo/article/details/51983812

你可能感兴趣的:(python,错误,python)