Mask rows and/or columns of a 2D array that contain masked values.
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
axis : int, optional
|
---|---|
Returns : | a : MaskedArray
|
Raises : | NotImplementedError :
|
See also
Notes
The input array’s mask is modified by this function.
Examples
>>> import numpy.ma as ma
>>> a = np.zeros((3, 3), dtype=np.int)
>>> a[1, 1] = 1
>>> a
array([[0, 0, 0],
[0, 1, 0],
[0, 0, 0]])
>>> a = ma.masked_equal(a, 1)
>>> a
masked_array(data =
[[0 0 0]
[0 -- 0]
[0 0 0]],
mask =
[[False False False]
[False True False]
[False False False]],
fill_value=999999)
>>> ma.mask_rowcols(a)
masked_array(data =
[[0 -- 0]
[-- -- --]
[0 -- 0]],
mask =
[[False True False]
[ True True True]
[False True False]],
fill_value=999999)