[Numpy-discussion] min() of array containing NaN

Travis E. Oliphant oliphant at enthought.com
Mon Aug 11 17:39:00 EDT 2008


Thomas J. Duck wrote:
> Determining the minimum value of an array that contains NaN produces  
> a surprising result:
>
>  >>> x = numpy.array([0,1,2,numpy.nan,4,5,6])
>  >>> x.min()
> 4.0
>
> I expected 0.0.  Is this the intended behaviour or a bug?  I am using  
> numpy 1.1.1.
>   
NAN's don't play well with comparisons because comparison with them is 
undefined.    See  numpy.nanmin

-Travis




More information about the NumPy-Discussion mailing list