I have a dataframe that has 3 columns -
I want to group the columns on the basis of Chopstick Length by doing something like this -
meansByCL = df_chopstick.groupby('Chopstick.Length')['Food.Pinching.Efficiency'].mean().reset_index()
but this throws an error -
AttributeError: Cannot access callable attribute 'groupby' of 'DataFrameGroupBy' objects, try using the 'apply' method
I'm not sure what this error means. Can anyone tell me what I'm doing wrong or how I can write this code differently?
This happens when you are trying to groupby()
a dataframe which has been already grouped before!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With