numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
compress_rowcols(x, axis=None)

The suppression behavior is selected with the :None:None:`axis` parameter.

Parameters

x : array_like, MaskedArray

The array to operate on. If not a MaskedArray instance (or if no array elements are masked), x is interpreted as a MaskedArray with :None:None:`mask` set to :None:None:`nomask`. Must be a 2D array.

axis : int, optional

Axis along which to perform the operation. Default is None.

Returns

compressed_array : ndarray

The compressed array.

Suppress the rows and/or columns of a 2-D array that contain masked values.

Examples

>>> x = np.ma.array(np.arange(9).reshape(3, 3), mask=[[1, 0, 0],
...  [1, 0, 0],
...  [0, 0, 0]])
... x masked_array( data=[[--, 1, 2], [--, 4, 5], [6, 7, 8]], mask=[[ True, False, False], [ True, False, False], [False, False, False]], fill_value=999999)
>>> np.ma.compress_rowcols(x)
array([[7, 8]])
>>> np.ma.compress_rowcols(x, 0)
array([[6, 7, 8]])
>>> np.ma.compress_rowcols(x, 1)
array([[1, 2],
       [4, 5],
       [7, 8]])
See :

Back References

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

numpy.ma.extras.compress_rows numpy.ma.extras.compress_cols

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/extras.py#842
type: <class 'function'>
Commit: