[Numpy-tickets] [NumPy] #980: NaN's are silenty converted to ints

NumPy numpy-tickets@scipy....
Wed Jan 7 07:23:53 CST 2009


#980: NaN's are silenty converted to ints
------------------------+---------------------------------------------------
 Reporter:  stefan      |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:  1.3.0   
Component:  numpy.core  |     Version:  none    
 Severity:  normal      |    Keywords:          
------------------------+---------------------------------------------------
 From a mailing list post by Josef:

 Why does converting nan to an integer not throw an exception (as with
 inf), instead numpy silently replaces nan by zero?

 {{{
 >>> inti = np.array([0,1,2])
 >>> inti[1] = np.inf
 Traceback (most recent call last):
  File "<pyshell#34>", line 1, in ?
    inti[1] = np.inf
 OverflowError: cannot convert float infinity to long
 >>> inti[1] = np.nan
 >>> inti
 array([0, 0, 2])
 }}}

-- 
Ticket URL: <http://scipy.org/scipy/numpy/ticket/980>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list