[Numpy-discussion] Medians that ignore values

Robert Kern robert.kern at gmail.com
Fri Sep 19 13:58:15 EDT 2008


On Fri, Sep 19, 2008 at 11:34, Alan G Isaac <aisaac at american.edu> wrote:
> On 9/19/2008 12:02 PM Peter Saffrey apparently wrote:
>> >>> a = array([1,2,nan])
>> >>> nan in a
>> False
>
> Huh.  I'm inclined to call this a bug,
> since normal Python behavior is that
> ``in`` should check for identity::
>
>        >>> xl = [1.,np.nan]
>        >>> np.nan in xl
>        True

Except that there are no objects inside non-object arrays. There is
nothing with identity inside the arrays to compare against.

-- 
Robert Kern

"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