Practice: Grade Matrix
Combine aggregation, broadcasting and boolean masks.
Example
s = np.array([[80, 70, 90], [60, 65, 70], [95, 85, 100]])
avg = s.mean(axis=1)
print(avg.round(1))
print(s - s.mean(axis=0))
print(np.where(avg > 75)[0])Result
[80. 65. 93.3] [[ 1.66666667 -3.33333333 3.33333333] [-18.33333333 -8.33333333 -16.66666667] [ 16.66666667 11.66666667 13.33333333]] [0 2]
Exercise
Row averages.
s.mean(axis=)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.