On Thu, Sep 25, 2008 at 10:56 PM, David Cournapeau < [EMAIL PROTECTED]> wrote:
> 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 ? > It shouldn't be any more difficult to do either based on a keyword. Argsorts shouldn't be a problem either. I'm thinking that the most flexible way to handle the sorts is to make a preliminary pass through the data and collect all the nans at one end or the other and sort the remainder. That would also make it easy to raise an error if we wanted to and avoid an extra compare in all the other sorting passes. That approach could probably be extended to masked arrays also. Chuck
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion