numpy 1.22.4 Pypi GitHub Homepage
Other Docs
NotesParametersReturnsBackRef
reshape(self, *s, **kwargs)

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.

Notes

The reshaping operation cannot guarantee that a copy will not be made, to modify the shape in place, use a.shape = s

Parameters

shape : int or tuple of ints

The 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'}, optional

Determines whether the array data should be viewed as in C (row-major) or FORTRAN (column-major) order.

Returns

reshaped_array : array

A new view on the array.

Give a new shape to the array without changing its data.

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.

Examples

This example is valid syntax, but we were not able to check execution
>>> 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)
This example is valid syntax, but we were not able to check execution
>>> x = x.reshape((4,1))
... x masked_array( data=[[--], [2], [3], [--]], mask=[[ True], [False], [False], [ True]], 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.reshape

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#4596
type: <class 'function'>
Commit: