[Numpy-discussion] Getting indices from numpy array with condition
Wed Nov 19 01:38:54 CST 2008
On Wed, Nov 19, 2008 at 01:31, David Warde-Farley <email@example.com> wrote:
> 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?
Why? In Python and numpy, False==0 and True==1.
"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