[Numpy-discussion] min() of array containing NaN
Charles Doutriaux
doutriaux1 at llnl.gov
Mon Aug 11 18:05:01 EDT 2008
Seems to me like min should automagically call nanmin if it spots any
nan no ?
C.
Fabrice Silva wrote:
> Try nanmin function :
>
> $ python
> Python 2.5.2 (r252:60911, Jul 31 2008, 07:39:27)
> [GCC 4.3.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import numpy
> >>> numpy.__version__
> '1.1.0'
> >>> x = numpy.array([0,1,2,numpy.nan, 4, 5, 6])
> >>> x.min()
> 4.0
> >>> numpy.nanmin(x)
> 0.0
>
> There lacks some nanmin method for array instances, i.e. one can not execute
> >>> x.nanmin()
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> AttributeError: 'numpy.ndarray' object has no attribute 'nanmin'
>
>
More information about the NumPy-Discussion
mailing list