[Numpy-discussion] min() of array containing NaN
Anne Archibald
peridot.faceted at gmail.com
Tue Aug 12 03:54:32 EDT 2008
2008/8/12 Stéfan van der Walt <stefan at sun.ac.za>:
> Hi Andrew
>
> 2008/8/12 Andrew Dalke <dalke at dalkescientific.com>:
>> This is buggy for the case of a list containing only NaNs.
>>
>> >>> import numpy as np
>> >>> np.NAN
>> nan
>> >>> np.min([np.NAN])
>> nan
>> >>> np.nanmin([np.NAN])
>> inf
>> >>>
>
> Thanks for the report. This should be fixed in r5630.
Er, is this actually a bug? I would instead consider the fact that
np.min([]) raises an exception a bug of sorts - the identity of min is
inf. Really nanmin of an array containing only nans should be the same
as an empty array; both should be infinity.
I guess this is a problem for types that don't have an infinity
(returning maxint is a poor substitute), but what is the correct
behaviour here?
Anne
More information about the NumPy-Discussion
mailing list