[Numpy-discussion] Numpy array performance issue

Robert Kern robert.kern@gmail....
Wed Feb 24 12:58:52 CST 2010

On Wed, Feb 24, 2010 at 12:38, Bruno Santos <bacmsantos@gmail.com> wrote:
> This is probably me just being stupid. But what is the reason for this peace
> of code not to be working:
> index_nSize=numpy.arange(0,length,nSize)
> lsPhasedValues = set([aLoci[i] for i in xrange(length) if (i%nSize==0 and
> aLoci[i]>0)])
> lsPhasedValues1 = numpy.where(aLoci[index_nSize]>0)

Because this is not correct. where() gives you indices where the
argument is True; you want the values in aLoci. Chris misunderstood
your request.

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