[Numpy-discussion] Medians that ignore values
Thu Sep 18 23:16:20 CDT 2008
Anne Archibald wrote:
> That was in amax/amin. Pretty much every other function that does
> comparisons needs to be fixed to work with nans. In some cases it's
> not even clear how: where should a sort put the nans in an array?
The problem is more on how the functions use sort than sort itself in
the case of median. There can't be a 'good' way to put nan in soft, for
example, since nans cannot be ordered.
I don't know about the best strategy: either we fix every function using
comparison, handling nan as a special case as you mentioned, or there
may be a more clever thing to do to avoid special casing everywhere. I
don't have a clear idea of how many functions rely on ordering in numpy.
More information about the Numpy-discussion