[Numpy-discussion] where

Travis Oliphant oliphant at ee.byu.edu
Thu Apr 13 09:18:05 CDT 2006


Ryan Krauss wrote:

>Can someone help me understand the proper use of where?
>
>I want to use it like this
>
>myvect=where(f>19.5 and phase>0, f, phase)
>
>but I seem to be getting or rather than and.
>
>  
>
It is probably your use of the 'and' statement.   Use '&' instead

(f > 19.5) & (phase > 0)

What version are you using.  In numarray and NumPy the use of 'and' like 
this should raise an error if 'f' and/or 'phase' are arrays of more than 
one element.

-Travis





More information about the Numpy-discussion mailing list