Aggregations & Statistics
sum, mean, and friends, plus what axis actually means.
axis confuses almost everyone at first. Read it as "the axis that
collapses": axis=0 collapses rows (you get one result per column),
axis=1 collapses columns (one result per row). No axis at all reduces
the whole array to a single number.
| Function | Returns | Example |
|---|---|---|
| average, standard deviation, variance |
|
| smallest / largest value |
|
| position of the smallest / largest value |
|
| median, 75th percentile |
|
| running total |
|
💡 Tip: Every aggregation has a NaN-safe twin: nanmean, nansum, nanmax, nanstd, nanmedian, nanquantile. Reach for them whenever missing data is possible.
Now practice it
Exercises that use what this lesson just covered.