[Numpy-discussion] Numpy array performance issue

Bruno Santos bacmsantos@gmail....
Thu Feb 25 10:20:57 CST 2010


This is the same example we discuss yesterday.
The working code is this one:
lsPhasedValues = [aLoci[i] for i in xrange(length) if i%21==0 and
aLoci[i]>0]
I was able to get the same result after a while:
aAux =aLoci[index_nSize]
lsPhasedValues = numpy.unique1d(aAux[numpy.where(aAux>0)[0]])

I couldn't came up with a better solution.

Thank you in advance,
Bruno

2010/2/25 Robert Kern <robert.kern@gmail.com>

> On Thu, Feb 25, 2010 at 07:51, Bruno Santos <bacmsantos@gmail.com> wrote:
> > I just realized that the line lsPhasedValues =
> > numpy.unique1d(aLoci[numpy.where(aLoci[index_nSize]>0)]) does not work
> > properly.
> > How can I get the unique values of an array based on their indexes?
>
> I don't know what that sentence means. Please show us some complete
> code that gives you a result that you do not expect and show us the
> result that you do expect.
>
> --
> 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
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100225/b89b30b4/attachment.html 


More information about the NumPy-Discussion mailing list