[Numpy-discussion] Getting indices from numpy array with condition

David Warde-Farley dwf@cs.toronto....
Wed Nov 19 01:31:04 CST 2008


On 18-Nov-08, at 3:06 PM, Robert Kern wrote:

> I like to discourage this use of where(). For some reason, back in
> Numeric's days, where() got stuck with two functionalities. nonzero()
> is the preferred function for this functionality. IMO, where(cond,
> if_true, if_false) should be the only use of where().

Hmm. nonzero() seems semantically awkward to be calling on a boolean  
array, n'est pas?

Truth be told I didn't know about the if_true, if_false use of where()  
until just now ;)

David


More information about the Numpy-discussion mailing list