[Numpy-discussion] take a numpy

Robert Kern robert.kern at gmail.com
Wed Sep 24 23:21:47 EDT 2008


On Wed, Sep 24, 2008 at 21:29, Dinesh B Vadhia
<dineshbvadhia at 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