I have an ordered array: numpy.array([1, 2, 5, 10, 25, 36, 66, 90, 121, 230, 333, 500])
Suppose I need all values up to 60 (if 60 is not found, I want to stop at the first value greater than 60), so I want to [1, 2, 5, 10, 25, 36, 66]. If I use numpy.where()with <= 60, it stops to 66.
My decision
from numpy import *
x = array([1, 2, 5, 10, 25, 36, 66, 90, 121, 230, 333, 500])
print x[:where(x >= 60)[0][0]+1]
>>>[ 1 2 5 10 25 36 66]