[Numpy-discussion] a==b for numpy arrays

Steve Lianoglou lists.steve at arachnedesign.net
Mon Dec 11 17:37:24 CST 2006


Hi,

It's not relevant to the point of this discussion all that much, but:

> a[a < 0] = 0
> a[less(a, 0)] = 0

Instead I've been doing something like:

a[where(a < 0)] = 0

I didn't realized you could do it the other way. Is there a  
difference somewhere between the two, or are they interchangeable?

I kind of like the shorter way (sans where clause) better ...

Thanks,
-steve


More information about the Numpy-discussion mailing list