[Numpy-discussion] Medians that ignore values

Alan G Isaac aisaac at american.edu
Fri Sep 19 11:36:17 EDT 2008


On 9/19/2008 11:09 AM Stefan Van der Walt apparently wrote:
> Masked arrays.  Using NaN's for missing values is dangerous.  You may  
> do some operation, which generates invalid results, and then you have  
> a mixed bag of missing and invalid values.

That rather evades my full question, I think?

In the case I mentioned,
I am filling an array inside a loop,
and the possible fill values are not constrained.
So I cannot mask based on value,
and I cannot mask based on position
(at least until after the computations are complete).

It seems to me that there are pragmatic reasons
why people work with NaNs for missing values,
that perhaps shd not be dismissed so quickly.
But maybe I am overlooking a simple solution.

Alan

PS I confess I do not understand NaNs.
E.g., why could there not be a value np.miss
that would be a NaN that represents a missing value?
Are all NaNs already assigned standard meanings?




More information about the NumPy-Discussion mailing list