‘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)