bundles / numpy 2.4.4 / numpy / ma / extras / mask_rowcols
function
numpy.ma.extras:mask_rowcols
source: /numpy/ma/extras.py :1035
Signature
def mask_rowcols ( a , axis = None ) Summary
Mask rows and/or columns of a 2D array that contain masked values.
Extended Summary
Mask whole rows and/or columns of a 2D array that contain masked values. The masking behavior is selected using the axis parameter.
If
axisis None, rows and columns are masked.If
axisis 0, only rows are masked.If
axisis 1 or -1, only columns are masked.
Parameters
a: array_like, MaskedArrayThe array to mask. If not a MaskedArray instance (or if no array elements are masked), the result is a MaskedArray with
maskset tonomask(False). Must be a 2D array.axis: int, optionalAxis along which to perform the operation. If None, applies to a flattened version of the array.
Returns
a: MaskedArrayA modified version of the input array, masked depending on the value of the
axisparameter.
Raises
: NotImplementedErrorIf input array
ais not 2D.
Notes
The input array's mask is modified by this function.
Examples
import numpy as np a = np.zeros((3, 3), dtype=int) a[1, 1] = 1 a a = np.ma.masked_equal(a, 1) a np.ma.mask_rowcols(a)✓
See also
- mask_cols
Mask cols of a 2D array that contain masked values.
- mask_rows
Mask rows of a 2D array that contain masked values.
- masked_where
Mask where a condition is met.
Aliases
-
numpy.ma.mask_rowcols