
故障汇总
汇总各类遇到的编程问题
北.海
这个作者很懒,什么都没留下…
展开
-
python报ValueError: cannot specify both a fill method and value
问题描述:在使用python进行缺失值填充时报该错误源代码:df1['age'].fillna(value=0,method='backfill')故障原因:不能同时指定填充方法和值解决方法:将fillna函数中的value参数配置为None,源代码修改为df1['age'].fillna(method='backfill')后执行成功...原创 2020-08-31 11:09:57 · 2514 阅读 · 0 评论 -
python报OSError: Initializing from file failed故障
现象描述:打开文件时,报Initializing from file failed从文件初始化失败。原语句为:df=pd.read_csv(r'作业单按原始期望日期查询529.csv')原因分析:原因为文件路径中包含了中文,由于read_csv函数的默认引擎engine为C,不支持对中文的识别,导致报该错误。在使用notebook打开文件时常见这个问题。解决方法:更改engine='python'即可执行成功。df=pd.read_csv(r'作业单按原始期望日期查询529.原创 2020-06-22 16:29:55 · 8304 阅读 · 2 评论 -
MySql 报ERROR 1292 (22007) 故障
在编辑MySql进行更改日期时报错,代码如下mysql> insert into date values ('zhangsan',92-01-02,99-03-04);ERROR 1292 (22007): Incorrect date value: '89' for column 'birth' at row 1更改为mysql> insert into date value...原创 2017-08-21 21:34:35 · 18348 阅读 · 0 评论 -
python IndexError: list assignment index out of range
在进行list的操作时报IndexError: list assignment index out of range故障解释:索引错误:列表的索引分配超出列范围源码:list=[]list[0]='a'输出:IndexError: list assignment index out of range该error原因是定义的list是个空列表,list[0]...原创 2017-08-29 10:59:01 · 21569 阅读 · 2 评论 -
mysql报ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must
mysql在建表时报故障ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a keycreate table ll( -> id int(5) not null auto_increment, ->...原创 2017-09-25 09:07:52 · 11561 阅读 · 0 评论 -
python报TypeError: cannot convert the series to <class>
场景:在使用python进行数据格式转换时,想将利用正则表达式取出的一列值转换为float格式,转换前检查该列的格式是object1:原格式查看in: data1['coupon_money'].dtypeout: dtype('O')2:转换in: data1['coupon_money']=float(data1['coupon_money'])ou...原创 2018-01-12 09:35:29 · 44305 阅读 · 1 评论 -
python 报 KeyError: ('coupon_type', 'occurred at index act_code')故障
在使用lambda函数时,系统报KeyError: ('coupon_type', 'occurred at index act_code') 故障原语句:data2['type_10001']=data2.apply(lambda x:1 if x['coupon_type']==10001 else 0)根据故障原因,修改语句为data2['type_10001']=data...原创 2018-01-15 20:09:26 · 14009 阅读 · 1 评论 -
python报UnicodeDecodeError故障
问题分析:要读取数据编码方式与python的编码方式不同处理:用txt打开对应的数据点击另存为,选择编码方式:3)在读入数据就ok了...原创 2019-10-23 20:00:01 · 2537 阅读 · 1 评论 -
python报Segmentation fault (core dumped)
问题描述:在linux运行python脚本时,脚本停止,没有任何故障记录,linux界面报Segmentation fault (core dumped)问题分析:网上有很多很高深的故障分析,我的遇到的比较简单,最后分析发现是有部分import的包在当前版本中没有,或者版本太低处理方法:将import的每一个包单独执行试一下,看哪个包导入有问题。如果有问题,install该包或者升级该包即...原创 2019-10-31 15:30:11 · 14990 阅读 · 2 评论