har*_*y04 5 python dataframe pandas pandas-groupby
我有一个包含 3 列的数据框 -
我想通过做这样的事情根据筷子长度对列进行分组 -
meansByCL = df_chopstick.groupby('Chopstick.Length')['Food.Pinching.Efficiency'].mean().reset_index()
Run Code Online (Sandbox Code Playgroud)
但这会引发错误-
AttributeError: Cannot access callable attribute 'groupby' of 'DataFrameGroupBy' objects, try using the 'apply' method
Run Code Online (Sandbox Code Playgroud)
我不确定这个错误是什么意思。谁能告诉我我做错了什么或者我如何以不同的方式编写这段代码?