I have the following numpy:
e = np.array([0, -1.3, 0, -3.9, 0, -0.9, 0])
I want to find the index of the maximum value in the list, but exclude 0.
The following code example returns first element in the list, because its value is 0.
result = np.argmax(e)
print(result)
But I want not to consider zeros in locating the maximum value:
The expected result should be 5 which is the index of the element with -0.9 value.
I do not want to write code that will run on the list iteratively.
Any ideas?