[ Web Proxy ]
URL:
Viewing: https://numpy.org/doc/stable/reference/generated/../generated/numpy.ma.compress_rows.html [Back]  [Original]

numpy.ma.compress_rows — NumPy v2.5 Manual
Back to top
Search the docs ...:

numpy.ma.compress_rows#

ma.compress_rows(a)[source]#

Suppress whole rows of a 2-D array that contain masked values.

This is equivalent to np.ma.compress_rowcols(a, 0), see compress_rowcols for details.

Parameters:
xarray_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 mask set to nomask. Must be a 2D array.

Returns:
compressed_arrayndarray

The compressed array.

See also

compress_rowcols

Examples

Try it in your browser!
>>> import numpy as np
>>> a = np.ma.array(np.arange(9).reshape(3, 3), mask=[[1, 0, 0],
...                                                   [1, 0, 0],
...                                                   [0, 0, 0]])
>>> np.ma.compress_rows(a)
array([[6, 7, 8]])

Web Proxy Viewer  |  New URL  |  Original Page