[SciPy-User] putmask and NaNs

kpal kpalamartchouk at gmail.com
Thu Feb 25 12:26:23 EST 2010


Hi, I observe a strange thing. scipy.putmask seems to treat NaN as
zero in the following piece of code:

mydata = scipy.array(((1,2,3,4,5),(1,1,-1,1,-1))).T
scipy.putmask(mydata[:,0], mydata[:,1]<0, [scipy.NaN])

At this moment I expect some of the values in mydata to be replaced by
NaNs, but they get replaced by zeros. Is this behaviour normal? Or is
it a bug?

Or is there another way to put NaNs according to a mask?

Python 2.5, scipy 0.7.0

Thanks,



More information about the SciPy-User mailing list