I have a table (data frame) with many columns. Now I would like to average values in one of the columns. It means that I need to group by over all columns except the one over which I need to average. Of course I can write:
df.groupby(['col1', 'col2', 'col3', 'col4', 'col5'])['vals'].mean()
But it would be nice if I could do something like:
df.groupby(['col6'], something='reverse')['vals'].mean()
Is it possible in pandas?