[Numpy-discussion] take a numpy

Robert Kern robert.kern@gmail....
Wed Sep 24 22:21:47 CDT 2008


On Wed, Sep 24, 2008 at 21:29, Dinesh B Vadhia
<dineshbvadhia@hotmail.com> wrote:
> I'm using numpy take() to pickout elements from a (1xM) array A indicated by
> the index numbers in indices ie.
>
> B = A.take(indices = list_indexes)
>
> It work perfectly but as A is large the performance isn't great and was
> wondering if there are faster methods available or ways to improve the use
> of take()?

If list_indexes is actually a Python list, then most of your time is
probably getting spent in converting the list to an array.

-- 
Robert Kern

"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 mailing list