Finding the index of greatest comparison of elements in a numpy array
I have an array a
and I want to find the position of the largest element in a
that given value is even greater.
In this example:
a = np.array([0, 50, 5, 52, 60])
v = 55
largest element that is v
greater than 52
(index 3), so I want to return 3.
The numpy function argmax()
does not work for this purpose as it returns the first item. What's the quick and correct way to do this with numpy?
+3
source to share