Lesson 9
Aggregation Functions
Crunch arrays:
a.sum() a.mean() a.min() a.max() a.argmax() # index of max
For 2D: axis=1 β rows.
Why this matters
Aggregations turn raw grids into summaries: totals per store, average score per student, or the index of the best candidate. The axis argument is the same idea you saw for indexingβjust applied to reduction.
Getting axis wrong is a classic bug; the diagram is the mental model to reach for.
ResourcesDocs, references & more β opens in a new tab
π― Your Task
Given sales = np.array([[100,150,200],[300,250,180],[90,310,270]]), sum per store (axis=1) β store_totals.
sales.sum(axis=1)
ββ run Β· ββ β nav
βΆ Output
Run your code to see output here.