bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / ma / core / MaskedArray / reshape
function
numpy.ma.core:MaskedArray.reshape
source: build-install/usr/lib/python3.14/site-packages/numpy/ma/core.py:4751
Signature
def reshape(self, *s, **kwargs)Summary
Give a new shape to the array without changing its data.
Extended Summary
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
shape: int or tuple of intsThe new shape should be compatible with the original shape. If an integer is supplied, then the result will be a 1-D array of that length.
order: {'C', 'F'}, optionalDetermines whether the array data should be viewed as in C (row-major) or FORTRAN (column-major) order.
Returns
reshaped_array: arrayA new view on the array.
Notes
The reshaping operation cannot guarantee that a copy will not be made, to modify the shape in place, use a.shape = s
Examples
import numpy as np x = np.ma.array([[1,2],[3,4]], mask=[1,0,0,1]) x x = x.reshape((4,1)) x
See also
- numpy.ndarray.reshape
Equivalent method on ndarray object.
- numpy.reshape
Equivalent function in the NumPy module.
- reshape
Equivalent function in the masked array module.
Aliases
numpy.ma.MaskedArray.reshape