df.assign(…).query(…).groupby(…)[['some', 'var']].sum().sort_values(…).iloc[:10].mean()
The problem with this approach is that it is not easy to get access to the results of intermediate steps. Recently I stumbled upon a solution!
df.assign(…).query(…).groupby(…)[['some', 'var']].sum().sort_values(…).iloc[:10].mean()
The problem with this approach is that it is not easy to get access to the results of intermediate steps. Recently I stumbled upon a solution!