AttributeError:无法访问DataFrameGroupBy对象的可调用属性groupby

2024-04-20 14:02:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个数据框有三列-

enter image description here

我想按筷子的长度来分组,做这样的事情-

meansByCL = df_chopstick.groupby('Chopstick.Length')['Food.Pinching.Efficiency'].mean().reset_index()

但这是个错误-

AttributeError: Cannot access callable attribute 'groupby' of 'DataFrameGroupBy' objects, try using the 'apply' method

我不知道这个错误意味着什么。有谁能告诉我我做错了什么,或者我怎样才能写出不同的代码?


Tags: 数据dffood错误mean事情lengthreset