您的位置:首页 > 移动开发 > Objective-C

‘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)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: