詹惠儿

2021-01-14   阅读量: 2716

Python

Python报错:AttributeError: 'float' object has no attribute 'lower'

扫码加入数据分析学习群

问:

Python报错:AttributeError: 'float' object has no attribute 'lower'

image.png


答:

出现以上报错是因为数据中存在的缺失值np.nan属于float类型,float型数据不支持lower()方法,

所以会报'float' object has no attribute 'lower'错误,可以通过Pandas的str属性解决此问题,

使用str属性会自动排除缺失值,代码如下:

image.png

52.1207 1 0 关注作者 收藏

评论(0)


暂无数据

推荐课程

推荐帖子