take, put and compress
take picks by index and compress filters by a condition array.
Example
a = np.array([10, 20, 30, 40])
print(a.take([0, 2]))
print(np.compress([True, False, True, False], a))
print(np.argmax(a), np.argmin(a))Result
[10 30] [10 30] 3 0
Exercise
Index of max.
np.(a)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.