- All Courses
- Python Foundations for Data Work
- Analysing Data with pandas
- Filtering, grouping, and aggregation
Filtering, grouping, and aggregation
Almost every analytical question is the same shape: split the rows into groups, apply an aggregation to each, and combine the results.
Overview
Split, apply, combine
Almost every analytical question is the same shape: split the rows into groups, apply an aggregation to each, and combine the results. Once you see it, group-by stops being syntax and becomes the tool you reach for.
Boolean masks compose with and-or operators, which keeps a multi-condition filter as one readable expression rather than a chain of intermediate frames.
Missing values need a decision, not a default. Dropping them, filling them, or treating them as a category are all defensible; ignoring the question is not, because different operations skip nulls differently.
In this lesson you will:
- Filter with boolean masks
- Group and aggregate in one expression
- Handle missing values on purpose
Resources
Notes are not saved yet — they clear when you leave this page.
DataFrames and Series
31m
Plotting results
22m