[Numpy-discussion] What is the different between nanmin and min ?

David Cournapeau david at ar.media.kyoto-u.ac.jp
Tue Jul 17 07:31:04 EDT 2007

Matthieu Brucher wrote:
> Hi,
> I encountered cases where numpy.min() returned nan when the first and 
> the last values were nan. Didn't know of nanmin(), but I'll use them now !
Mmh, interesting. Indeed, a quick test shows that as long as the last 
value of a rank 1 array is not Nan, min ignore nan.

import numpy
a = 0.1 * numpy.arange(10)
a[:9] = numpy.nan
numpy.min(a) # ignore Nan
a = 0.1 * numpy.arange(10)
a[-1] = numpy.nan
numpy.min(a) # Does not ignore Nan



More information about the NumPy-Discussion mailing list