"where" in python

Robert Kern robert.kern at gmail.com
Thu Jun 4 18:44:43 EDT 2009


On 2009-06-04 12:53, Chris wrote:
> I am a newby in Python and I'm first looking for equivalent to things
> I already manage: IDL.
> For example, I want to plot a sub-set of points, selected from a
> bigger set by applying some filter. In my example, I want to select
> only the values>  0.
> I succeed to write 5 different ways to do this, which one is the more
> efficient, the quicker, the more Python?

You will want to ask numpy questions on the numpy mailing list.

   http://www.scipy.org/Mailing_Lists

The 1st method. The rest just do a lot of extra work or use old APIs.

> It seems the 4th method give wrong results, but I don't know why...
> Thanks for your tips,
> Christophe
> ------------------------------------------------------------------------------------------
> import pylab as pylab
> import numpy as numpy

You don't need to use "as" unless if you are renaming the modules.

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