I intend to combine columns of a Pandas DataFrame after groupby
. I looked for options that I can use but none of them does what I'm looking for. The closest option was .agg()
which performs on values of a column, however, I want to calculate a statistic of all features
for every given groupbyed row.
I am looking for something like this:
dataset.groupby(['company', 'team']).combine(new_cols=['features_mean'], to_combine=['feature 1':'feature 2'], funcs=[np.mean], axis=1)