[Numpy-tickets] [NumPy] #1002: MaskedArray.resize method raises TypeError

NumPy numpy-tickets@scipy....
Fri Feb 6 03:52:50 CST 2009


#1002: MaskedArray.resize method raises TypeError
---------------------------+------------------------------------------------
 Reporter:  ScottSinclair  |       Owner:  pierregm
     Type:  defect         |      Status:  new     
 Priority:  normal         |   Milestone:  1.3.0   
Component:  numpy.ma       |     Version:  none    
 Severity:  normal         |    Keywords:          
---------------------------+------------------------------------------------
 A TypeError is raised by the MaskedArray.resize() method.

 {{{
 Python 2.5.2 (r252:60911, Oct  5 2008, 19:24:49)
 [GCC 4.3.2] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import numpy as np
 >>> np.__version__
 '1.3.0.dev6344'
 >>> x = np.ma.array([0,1,2])
 >>> x.resize((2,))
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/home/scott/.virtualenvs/scipy-dev/lib/python2.5/site-
 packages/numpy/ma/core.py", line 2721, in resize
     self._data.resize(newshape, refcheck, order)
 TypeError: an integer is required
 >>> np.ma.resize(x, (2,))
 masked_array(data = [0 1],
              mask = False,
        fill_value = 999999)

 >>> x = np.array([0,1,2])
 >>> x.resize((2,))
 >>> x
 array([0, 1])
 }}}

 Changing the default value for 'refcheck' from True to 1 in
 numpy/ma/core.py doesn't resolve the problem. Any fix, should also
 consider #840, since the 'order' keyword to the ndarray.resize() method is
 broken.

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


More information about the Numpy-tickets mailing list