[NumPy-Tickets] [NumPy] #1973: Can not display a masked array containing np.NA values even if masked

NumPy Trac numpy-tickets@scipy....
Fri Nov 4 11:44:53 CDT 2011


#1973: Can not display a masked array containing np.NA values even if masked
------------------------+---------------------------------------------------
 Reporter:  bsouthey    |       Owner:  pierregm   
     Type:  defect      |      Status:  new        
 Priority:  high        |   Milestone:  Unscheduled
Component:  numpy.ma    |     Version:  devel      
 Keywords:  masked, NA  |  
------------------------+---------------------------------------------------
 I get an error when displaying a masked array that contains the new
 missing value, np.NA under 64-bit Linux. But the operations seem to work
 as expected.

 {{{
 >>> import numpy as np
 >>> np.__version__
 '2.0.0.dev-7297785'
 >>> b=np.ma.array([3,5,np.NA,6], mask=[0,0,1,0])
 >>> b
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/lib64/python2.7/site-packages/numpy/ma/core.py", line 3551,
 in __repr__
     data=str(self), mask=str(self._mask),
   File "/usr/lib64/python2.7/site-packages/numpy/ma/core.py", line 3534,
 in __str__
     res = self._data.astype("O")
 ValueError: Cannot assign NA to an array which does not support NAs
 >>> b._data
 array([3, 5, NA, 6])
 >>> b.sum()
 14
 >>> b.mask=[0,0,0,0]
 >>> b
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/lib64/python2.7/site-packages/numpy/ma/core.py", line 3551,
 in __repr__
     data=str(self), mask=str(self._mask),
   File "/usr/lib64/python2.7/site-packages/numpy/ma/core.py", line 3534,
 in __str__
     res = self._data.astype("O")
 ValueError: Cannot assign NA to an array which does not support NAs
 >>> b.sum()
 NA(dtype='int64')
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1973>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list