[Numpy-discussion] Getting an array's indices when a given condition is true
Sat Oct 18 22:13:16 CDT 2008
On Sat, Oct 18, 2008 at 22:00, Lane Brooks <firstname.lastname@example.org> wrote:
> If you want the indexes, check out the np.where command, e.g.
> idx = np.where(dat <= limit)
It's worth noting that where() confusingly has two modes of
functionality. This particular bit of functionality is also exposed
under the better-named nonzero() function. I prefer to use nonzero()
for this, and only use where() for its where(condition, value_if_true,
"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