You are viewing an older version (2.4.3). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.4.3 / 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 axis is None, rows and columns are masked.

  • If axis is 0, only rows are masked.

  • If axis is 1 or -1, only columns are masked.

Parameters

a : array_like, MaskedArray

The array to mask. If not a MaskedArray instance (or if no array elements are masked), the result is a MaskedArray with mask set to nomask (False). Must be a 2D array.

axis : int, optional

Axis along which to perform the operation. If None, applies to a flattened version of the array.

Returns

a : MaskedArray

A modified version of the input array, masked depending on the value of the axis parameter.

Raises

: NotImplementedError

If input array a is 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