Pivot table

Applies to: python, sql

A pivot table reshapes data so categories become columns and aggregated values fill the cells.

df.pivot_table(index="month", columns="plan", values="revenue", aggfunc="sum")

See also: groupby-pandas, aggregate-function