[Numpy-discussion] how to do this efficiently?
Alan G Isaac
Wed Feb 9 11:17:45 CST 2011
On 2/9/2011 11:39 AM, Bruce Southey wrote:
> np.argmax(x>5) # doesn't appear to be correct
It was an answer to the particular question
of how to do find_first, which it does
(at the cost of a boolean array):
it finds the first element greater than 5.
array([5, 4, 3, 6, 7, 3, 2, 1])
You can also find the first element less than 4, etc.
The condition should be chosen for the problem.
As Josef pointed out, the usefulness
of this and other approaches
can depend on the monotonicity
of the series.
More information about the NumPy-Discussion