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

Keith Goodman kwgoodman at gmail.com
Tue Sep 19 14:34:16 CDT 2006


In what order would you like argsort to sort the values -inf, nan, inf?

In numpy 1.0b1 nan is always left where it began:

EXAMPLE 1

>> x

matrix([[              inf],
        [             -inf],
        [              nan]])
>> x[x.argsort(0),:]

matrix([[             -inf],
        [              inf],
        [              nan]])

EXAMPLE 2

>> x

matrix([[                  nan],
        [                  inf],
        [                 -inf]])
>> x[x.argsort(0),:]

matrix([[                  nan],
        [                 -inf],
        [                  inf]])


I would like nan to be in the middle between -inf and inf.




More information about the Numpy-discussion mailing list