So I've been looking all over on the internet, but I cannot find out how to do this without a for loop + if statement. Let's say that I have this as my array:
import numpy as np
a = np.array([361, 362, 363, 364, 365, 0, 1, 2, 366, 367])
I want to find out to find out the first highest value (regardless if there is another higher value in the future), which in this case would be 365
. This is how I would do it without using numpy:
import numpy as np
a = np.array([361, 362, 363, 364, 365, 0, 1, 2, 366, 367])
for element in range(a.shape[0]-1):
if a[element+1] < a[element]:
first_max = a[element]
break
print(first_max)
# 365
Is there a way to do this using a numpy function?