sum, mean, min, max and axes
Aggregations reduce an array. axis chooses the direction.
Example
a = np.array([[1, 2, 3], [4, 5, 6]])
print(a.sum(), a.sum(axis=0), a.sum(axis=1))
print(a.mean(), a.min(axis=1), a.max())Result
21 [5 7 9] [ 6 15] 3.5 [1 4] 6
Exercise
Column sums.
a.sum(axis=)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.