Reputation: 1393
For example,
a = np.array([[1,2,3]
[1,0,4]
[2,1,1]])
and then for each row I would find the number of values greater than a corresponding value in another array, say b = np.array([2,1,0]), and the expected result is an array [1,1,3] (first row, one number greater than 2, second row, one number greater than 1, and the third row three numbers greater than 0).
Is there a way to use numpy build-in methods to achieve this? Many thanks!
Upvotes: 2
Views: 970