[Numpy-discussion] Proper NaN handling in max and co: a redux

David Cournapeau david@ar.media.kyoto-u.ac...
Thu Sep 25 23:56:34 CDT 2008


Charles R Harris wrote:
>
> I'm also wondering about the sign ufunc. It should probably return nan
> for nans, but -1,0,1 are the current values. We also need to decide
> which end of the sorted values the nans should go to. I'm a bit
> partial to the beginning but the end would be fine with me, it might
> even be a bit more natural as searchsorted would find the beginning of
> the nans by default.

Note that in both suggest approaches, sort with NaN would raise an
error. We could then provide a nansort, which ignore the NaN, and deal
with your case; would it be hard to have an option for the beginning vs
the end, or would that be difficult ?

cheers,

David


More information about the Numpy-discussion mailing list