1.脚本报错
报错:
KeyError: “None of [Int64Index([ 0, 1, 2, 3, 4, 5,
6, 7, 8, 10,\n …\n 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, 2071],\n dtype=‘int64’, length=1864)] are in the [columns]”
解决方法:
将数据转换成np.array()。
2. matplotlib添加图例出现问题
报错:
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe5 in position 0: ordinal not in range(128)
解决方法:
在代码前添加以下几行代码即可解决问题
#coding=utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
方法来源于博客:
https://blog.csdn.net/qq_35393693/article/details/85307809
3.pandas中Series转list,dataframe
Series.tolist()
可参考博客https://blog.csdn.net/sinat_26811377/article/details/99292830
https://blog.csdn.net/dta0502/article/details/82966790
4. linux打开jupyter notebook出现问题
报错:Firefox is already running, but is not responding. To open a new window, you must first close the existing …?
解决方案:在linux终端输入
firefox -profilemanager
新建一个profile,并选择这个新的profile即可
参考博客:
https://blog.csdn.net/helloworld0906/article/details/98185966