[Numpy-discussion] average of array containing NaN
Giorgio F. Gilestro
Mon Jun 25 14:36:16 CDT 2007
Masked array seems definitely to be the way to go, thanks a lot.
I must say that this entire issue doesn't make much sense to me: my
understanding is the a NaN is different from an INF, therefore one
would assume that really there is no reason why a not-number should
not be ignored by default by all the array manipulating functions.
On 6/25/07, Pierre GM <firstname.lastname@example.org> wrote:
> On Monday 25 June 2007 14:15:20 Giorgio F. Gilestro wrote:
> > Thanks.
> > Actually those I care the most are average and std.
> > Is there a way to know the number of NaN in an array?
> You could use:
> But once again
> masked arrays were designed to handle this kind of situation seamlessly. Just
> create a masked_array
> masked_array(x, mask=isnan(x))
> and use the regular functions/methods on the masked array.
> Numpy-discussion mailing list
More information about the Numpy-discussion