[Numpy-discussion] Medians that ignore values
Peter Saffrey
pzs@dcs.gla.ac...
Fri Sep 19 11:02:08 CDT 2008
Alan G Isaac <aisaac <at> american.edu> writes:
> Recently I needed to fill a 2d array with values
> from computations that could "go wrong".
> I created an array of NaN and then replaced
> the elements where the computation produced
> a useful value. I then applied ``nanmax``,
> to get the maximum of the useful values.
>
I'm glad you posted this, because this is exactly the method I'm using. How do
you detect whether there are still any missing spots in your array? nan has some
rather unfortunate properties:
>>> from numpy import *
>>> a = array([1,2,nan])
>>> nan in a
False
>>> nan == nan
False
Should I take the earlier advice and switch to masked arrays?
Peter
More information about the Numpy-discussion
mailing list