method
MaskedArray.reshape(self, *s, **kwargs)
[source]
Give a new shape to the array without changing its data.
Returns a masked array containing the same data, but with a new shape. The result is a view on the original array; if this is not possible, a ValueError is raised.
Parameters: |
|
---|---|
Returns: |
|
See also
reshape
numpy.ndarray.reshape
numpy.reshape
The reshaping operation cannot guarantee that a copy will not be made, to modify the shape in place, use a.shape = s
>>> x = np.ma.array([[1,2],[3,4]], mask=[1,0,0,1]) >>> x masked_array( data=[[--, 2], [3, --]], mask=[[ True, False], [False, True]], fill_value=999999) >>> x = x.reshape((4,1)) >>> x masked_array( data=[[--], [2], [3], [--]], mask=[[ True], [False], [False], [ True]], fill_value=999999)
© 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
https://docs.scipy.org/doc/numpy-1.17.0/reference/generated/numpy.ma.MaskedArray.reshape.html