[Numpy-discussion] Medians that ignore values
Charles R Harris
Fri Sep 19 11:25:07 CDT 2008
On Fri, Sep 19, 2008 at 1:11 AM, David Cournapeau <
> Anne Archibald wrote:
> > Well, for example, you might ask that all the non-nan elements be in
> > order, even if you don't specify where the nan goes.
> Ah, there are two problems, then:
> - sort
> - how median use sort.
> For sort, I don't know how sort speed would be influenced by treating
> nan. In a way, calling sort with nan inside is a user error (if you take
> the POV nan are not comparable), but nan are used for all kind of
used <- misused. Using nan to flag anything but a numerical error is going
to cause problems. It wouldn't be too hard to implement nansorts, they just
need a real comparison function so that all the nans end up at on end or the
other. I don't know that that would make medians any easier, though. Are the
nans part of the data set? A nansearchsorted would probably be needed also.
If this functionality is added, the best way might be something like
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion