Guided Notes

Aggregations & Math Functions

sum, prod, mean, min/max across axes, cumulative sums, differences, LCM/GCD, and trigonometry.

Summing and averaging

Slide 1 / 5

Aggregations reduce many values to fewer:

arr.sum(), arr.mean(), arr.min(), arr.max(), arr.std() np.median(arr), np.percentile(arr, 90)

On 2-D arrays, choose the axis: β€’ no axis β€” one result for the whole array. β€’ axis=0 β€” one result per column. β€’ axis=1 β€” one result per row.

arr.argmax() and arr.argmin() return the position of the largest or smallest value instead of the value itself.

← Ufuncs & Broadcasting