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

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to