
Jan. 25, 2009
1:03 p.m.
2009/1/25 Matthew Brett <matthew.brett@gmail.com>:
When converting arrays from float to ints, I notice that NaNs, Infs, and -Infs all get the minimum integer value:
flts = np.array([np.nan, np.inf, -np.inf]) flts.astype(np.int16) array([-32768, -32768, -32768], dtype=int16)
However, setting NaNs into integer arrays gives a value of 0
I find this behaviour surprising too. There is a ticket at http://projects.scipy.org/scipy/numpy/ticket/980 Cheers Stéfan