[Numpy-discussion] min() of array containing NaN
Mon Aug 11 18:41:39 CDT 2008
*cough* MaskedArrays anyone ? *cough*
The ideal would be for min/max to output a NaN when there's a NaN somewhere.
That way, you'd know that there's a potential pb in your data, and that you
should use the nanfunctions or masked arrays.
is there a page on the wiki for that matter ? It seems to show up regularly...
On Monday 11 August 2008 18:49:06 Stéfan van der Walt wrote:
> 2008/8/11 Charles Doutriaux <firstname.lastname@example.org>:
> > Seems to me like min should automagically call nanmin if it spots any
> > nan no ?
> Nanmin is quite a bit slower:
> In : x = np.random.random((5000))
> In : timeit np.min(x)
> 10000 loops, best of 3: 24.8 µs per loop
> In : timeit np.nanmin(x)
> 10000 loops, best of 3: 136 µs per loop
> So, I'm not sure if that will happen. One option is to use `nanmin`
> by default, and to provide `min` for people who need the speed. The
> fact that results with nan's are almost always unexpected is certainly
> a valid concern.
> Numpy-discussion mailing list
More information about the Numpy-discussion