x.min() depends on ordering

Keith Goodman kwgoodman at gmail.com
Sat Nov 11 17:04:29 CST 2006


x.min() and x.max() depend on the ordering of the elements:

>> x = M.matrix([[ M.nan, 2.0, 1.0]])
>> x.min()
nan

>> x = M.matrix([[ 1.0, 2.0, M.nan]])
>> x.min()
1.0

If I were to try the latter in ipython, I'd assume, great, min()
ignores NaNs. But then the former would be a bug in my program.

Is this related to how sort works?

>> x = M.matrix([[ M.nan, 2.0, 1.0]])
>> x.sort()
>> x
matrix([[                  nan,            1.        ,            2.        ]])

>> x = M.matrix([[ 1.0, 2.0, M.nan]])
>> x.sort()
>> x
matrix([[ 1.        ,  2.        ,         nan]])

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Numpy-discussion mailing list