[Numpy-discussion] how to do this efficiently?

Zachary Pincus zachary.pincus at yale.edu
Wed Feb 9 10:14:07 EST 2011

> In a 1-d array, find the first point where all subsequent points  
> have values
> less than a threshold, T.

Maybe something like:

last_greater = numpy.arange(arr.shape)[arr >= T][-1]
first_lower = last_greater + 1

There's probably a better way to do it, without the arange, though...

More information about the NumPy-Discussion mailing list