[Numpy-discussion] NaN, min, and max
Keith Goodman
kwgoodman@gmail....
Wed Feb 7 11:15:38 CST 2007
I keep running into this problem:
>> import numpy.matlib as M
>> x = M.rand(3,3)
>> x[1,1] = M.nan
>> x
matrix([[ 0.94425407, 0.02216611, 0.999475 ],
[ 0.40444129, nan, 0.23264341],
[ 0.24202372, 0.05344269, 0.37967564]])
>> x.max()
0.379675636032 <---- Wrong (for me)
>> x[1,1] = 0
>> x.max()
0.999474999444 <----- Beautiful! Look at all the tripple digits!
How do I add nanmax as a method of the matrix class? How would I
replace max with nanmax? Would I have to do that in every module of my
package if I want to access numpy.matlib as M instead of
packagename.M?
More information about the Numpy-discussion
mailing list