Guided Notes
Pivot Tables & Reshaping
pivot_table, crosstab, and reshaping between wide and long formats with melt and pivot.
Pivot tables in pandas
Slide 1 / 5A pivot table summarizes data in a grid β the same idea as Excel's PivotTables:
df.pivot_table(index='region', columns='quarter', values='sales', aggfunc='sum')
β’ index β the row labels. β’ columns β the column labels. β’ values β the numbers to summarize. β’ aggfunc β how to summarize: 'sum', 'mean', 'count', or a list of several.
It's groupby plus unstack in one call.
