[Numpy-discussion] sorting -inf, nan, inf

Keith Goodman kwgoodman at gmail.com
Tue Sep 19 16:06:40 EDT 2006


On 9/19/06, A. M. Archibald <peridot.faceted at gmail.com> wrote:
> On 19/09/06, Tim Hochberg <tim.hochberg at ieee.org> wrote:
> > Keith Goodman wrote:
> > > In what order would you like argsort to sort the values -inf, nan, inf?
> > >
> > Ideally, -inf should sort first, inf should sort last and nan should
> > raise an exception if present.
> >
> > -tim
>
> Mmm. Somebody who's working with NaNs has more or less already decided
> they don't want to be pestered with exceptions for invalid data. I'd
> be happy if they wound up at either end, but I'm not sure it's worth
> hacking up the sort algorithm when a simple isnan() can pull them out.

Is there an easy way to use isnan to pull out the nans if the matrix I
am sorting has more than one column?




More information about the NumPy-Discussion mailing list