[Numpy-discussion] average of array containing NaN

Robert Kern robert.kern at gmail.com
Mon Jun 25 15:41:29 EDT 2007

Giorgio F. Gilestro wrote:
> 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.

Because NaNs might also signal an error. Generally speaking, operations that
involve NaNs should return NaNs. Operations that do something else with NaNs,
like ignoring them, are special.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the NumPy-Discussion mailing list