[Numpy-discussion] A question about argmax and argsort
robert.kern at gmail.com
Wed Dec 20 17:34:32 CST 2006
Pierre GM wrote:
> On Wednesday 20 December 2006 18:02, Tom Denniston wrote:
>> If you want the n largest item i would recommend quicksort
>> I don't know of a way to do this in numpy. I think it would require
>> adding a cfunction to numpy. Perhaps an "argnth" function?
>> Does anyone else know of an existing mechanism?
> Is it really needed when you have argsort ?
> array([0, 3, 1, 4, 2])
>>>> x[ax], x[ax[-1]], x[ax-3]]
> 1, 5, 3
> Or am I once again missing the point entirely ?
There are algorithms that can be faster if you can ignore the bulk of the
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion