[Numpy-discussion] Re: where
Robert Kern
robert.kern at gmail.com
Thu Apr 13 09:42:04 CDT 2006
Ryan Krauss wrote:
> Does where return a mask?
>
> If I do
> myvect=where((f > 19.5) & (phase > 0),f,phase)
> myvect is the same length as f and phase and there is some
> modification of the values where the condition is met, but what that
> modification is is unclear to me.
>
> If I do
> myind=where((f > 19.5) & (phase > 0))
> I seem to get the indices of the points where both conditions are met.
>
> I am using version 0.9.5.2043. I see those kinds of errors about
> truth testing an array often, but not in this case.
Have you read the docstring?
In [33]: where?
Type: builtin_function_or_method
Base Class: <type 'builtin_function_or_method'>
String Form: <built-in function where>
Namespace: Interactive
Docstring:
where(condition, | x, y) is shaped like condition and has elements of x and
y where condition is respectively true or false. If x or y are not given, then
it is equivalent to nonzero(condition).
--
Robert Kern
robert.kern at gmail.com
"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
mailing list