numpy 1.22.4 Pypi GitHub Homepage
Other Docs
BackRef
resize(x, new_shape)

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

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

See Also

numpy.resize

Equivalent function in the top level NumPy module.

Examples

This example is valid syntax, but we were not able to check execution
>>> import numpy.ma as ma
... a = ma.array([[1, 2] ,[3, 4]])
... a[0, 1] = ma.masked
... a masked_array( data=[[1, --], [3, 4]], mask=[[False, True], [False, False]], fill_value=999999)
This example is valid syntax, but we were not able to check execution
>>> np.resize(a, (3, 3))
masked_array(
  data=[[1, 2, 3],
        [4, 1, 2],
        [3, 4, 1]],
  mask=False,
  fill_value=999999)
This example is valid syntax, but we were not able to check execution
>>> ma.resize(a, (3, 3))
masked_array(
  data=[[1, --, 3],
        [4, 1, --],
        [3, 4, 1]],
  mask=[[False,  True, False],
        [False, False,  True],
        [False, False, False]],
  fill_value=999999)

A MaskedArray is always returned, regardless of the input type.

This example is valid syntax, but we were not able to check execution
>>> a = np.array([[1, 2] ,[3, 4]])
... ma.resize(a, (3, 3)) masked_array( data=[[1, 2, 3], [4, 1, 2], [3, 4, 1]], mask=False, fill_value=999999)
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.ma.core.MaskedArray.resize

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/ma/core.py#7164
type: <class 'function'>
Commit: