I have a list like this
myList = [0.0 , 0.0, 0.0, 2.0, 2.0]
I would like to find the location of the first number in the list that is not e
How about doing following:
print (np.nonzero(np.array(myList))[0][0])
This is more convenient because along with finding non-zero values, this can also help to apply logic function directly. For example:
print (np.nonzero(np.array(myList)>1))