pivot
Wed Jan 05 2022 08:14:52 GMT+0000 (Coordinated Universal Time)
Saved by
@ahoeweler
df.pivot_table(values='col1', index='col2', aggfunc=[np.median, np.mean]) # index can also be list of columns
# other way
df.pivot_table(values='col1', index='col2', columns='col3', fill_value=0, margins=True) # margins for summary statistic
content_copyCOPY
Comments