Pandas dataframe: how to apply describe() to each group and add to new columns?
there is even a shorter one 🙂 print df.groupby(‘name’).describe().unstack(1) Nothing beats one-liner: In [145]: print df.groupby(‘name’).describe().reset_index().pivot(index=’name’, values=”score”, columns=”level_1″)