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 / resize

function

numpy.ma.core:resize

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

Signature

def   resize ( x new_shape )

Summary

Return a new masked array with the specified size and shape.

Extended Summary

This is the masked equivalent of the numpy.resize function. The new array is filled with repeated copies of x (in the order that the data are stored in memory). If x is masked, the new array will be masked, and the new mask will be a repetition of the old one.

Examples

import numpy as np
import numpy.ma as ma
a = ma.array([[1, 2] ,[3, 4]])
a[0, 1] = ma.masked
a
np.resize(a, (3, 3))
ma.resize(a, (3, 3))
A MaskedArray is always returned, regardless of the input type.
a = np.array([[1, 2] ,[3, 4]])
ma.resize(a, (3, 3))

See also

numpy.resize

Equivalent function in the top level NumPy module.

Aliases

  • numpy.ma.resize