报错信息
小羊来66
只会Command C+V
展开
-
报错信息: TypeError: ufunc ‘isnan‘ not supported for the input types, and the inputs could not be safe
解决方法:将np.isnan改为pd.isna例子:import numpy as npimport pandas as pdprint('Missing: %d' % sum(np.isnan(X).flatten()))改为:print('Missing: %d' % sum(pd.isna(X).flatten()))参考:https://github.com/slundberg/shap/issues/677...原创 2021-10-19 20:09:38 · 1601 阅读 · 0 评论 -
Python 批量读取csv文件报错 UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xb7 in position 2: invalid
Python 批量读取csv文件报错 UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xb7 in position 2: invalid start byte方法一:在read_csv函数中,加上encoding=‘gbk’。 df = pd.read_csv(file_path + '/' + filename[i], encoding='gbk')遇上某些文件会继续报错``UnicodeDecodeError: 'gbk原创 2021-10-14 19:30:40 · 1382 阅读 · 1 评论 -
使用matplotlib时出现segment fault错误
问题描述:使用matplotlib的plt.show()函数时,图像显示一秒就自动关闭,且报错:segment fault xxxxx。解决方案:加入以下两行代码import matplotlib as mplmpl.use('TkAgg')原创 2020-12-18 17:09:43 · 652 阅读 · 1 评论