You are viewing an older version (2.4.3). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.4.3 / numpy / ma / core / reshape

function

numpy.ma.core:reshape

source: /numpy/ma/core.py :7630

Signature

def   reshape ( a new_shape order = C )

Summary

Returns an array containing the same data with a new shape.

Extended Summary

Refer to MaskedArray.reshape for full documentation.

Examples

Reshaping a 1-D array:
a = np.ma.array([1, 2, 3, 4])
np.ma.reshape(a, (2, 2))
Reshaping a 2-D array:
b = np.ma.array([[1, 2], [3, 4]])
np.ma.reshape(b, (1, 4))
Reshaping a 1-D array with a mask:
c = np.ma.array([1, 2, 3, 4], mask=[False, True, False, False])
np.ma.reshape(c, (2, 2))

See also

MaskedArray.reshape

equivalent function

Aliases

  • numpy.ma.reshape