‘DataFrame‘ object has no attribute ‘cut‘
2020-08-02 19:07
2723 查看
‘DataFrame’ object has no attribute ‘cut’
**问题:**使用pandas时处理数据运用cut()函数处理数据时报错’DataFrame’ object has no attribute ‘cut’。
**原因:**函数调用错误。
**解决:**通过pandas库调用cut(),不能直接对数据使用。
bins = [df.score.min()-1,400,450,df.score.max()+1] lable = ['一般','较好','优秀'] df['类别'] = pd.cut(df.score,bins,right = False,labels = lable) print(df)
相关文章推荐
- 成功解决AttributeError: 'DataFrame' object has no attribute 'reshape'
- AttributeError: 'DataFrame' object has no attribute 'convert_dtypes'
- # Pycharm关于AttributeError: 'DataFrame' object has no attribute 'score'的错误
- python jieba 结巴分词报错 AttributeError: 'module' object has no attribute 'cut'
- Spark报错AttributeError: 'DataFrame' object has no attribute 'axes'
- AttributeError: 'DataFrame' object has no attribute 'name',求指教
- python jieba 结巴分词报错 AttributeError: 'module' object has no attribute 'cut'
- 'DataFrame' object has no attribute 'save' 已解决
- 'celery' object has no attribute 'utils
- AttributeError: ‘module‘ object has no attribute ‘run‘
- [Python]attributeError:'module' object has no attribute 'dump'
- AttributeError: 'module' object has no attribute 'LabelMap'
- AttributeError: 'module' object has no attribute(转)
- AttributeError: 'module' object has no attribute 'face' 问题解决 opencv+python
- Python用pymysql连接Mysql报错 'Connection' object has no attribute 'set_character_set'
- web.py 直接使用示例代码,web.application报错, 'module' object has no attribute 'application',问题原因分析
- django 报错'NoneType' object has no attribute 'strftime'
- 解决python中问题AttributeError: 'collections.defaultdict' object has no attribute 'iteritems'
- 'module' object has no attribute 'rindex'