[Numpy-discussion] average of array containing NaN

Giorgio F. Gilestro giorgio at gilestro.tk
Mon Jun 25 14:15:20 EDT 2007


Thanks.
Actually those I care the most are average and std.
Is there a way to know the number of NaN in an array?




On 6/25/07, Timothy Hochberg <tim.hochberg at ieee.org> wrote:
>
>
>
> On 6/25/07, Giorgio F. Gilestro <giorgio at gilestro.tk> wrote:
> > I find myself in a situation where an array may contain not-Numbers
> > that I set as NaN.
> > Yet, whatever operation I do on that array( average, sum...) will
> > threat the NaN as infinite values rather then ignoring them as I'd
> > like it'd do.
>
> > Am I missing something? Is this a bug or a feature? :-)
>
> Neither. The best behaviour would probably be to throw an exception, but the
> extra checking that would require might well slow down other stuff.
>
> Try looking at the following functions, they should let you do what you
> want:
>
> 'nanargmax', 'nanargmin', 'nanmax', 'nanmin', 'nansum'
>
>
> > _______________________________________________
> > Numpy-discussion mailing list
> > Numpy-discussion at scipy.org
> >
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
> >
>
>
>
> --
> .  __
> .   |-\
> .
> .  tim.hochberg at ieee.org
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>



More information about the NumPy-Discussion mailing list