-
numpy.ma.mask_cols(a, axis=None)
[source] -
Mask columns of a 2D array that contain masked values.
This function is a shortcut to
mask_rowcols
withaxis
equal to 1.See also
-
mask_rowcols
- Mask rows and/or columns of a 2D array.
-
masked_where
- Mask where a condition is met.
Examples
12345678910111213141516171819202122232425262728>>>
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_cols(a)
masked_array(data
=
[[
0
-
-
0
]
[
0
-
-
0
]
[
0
-
-
0
]],
mask
=
[[
False
True
False
]
[
False
True
False
]
[
False
True
False
]],
fill_value
=
999999
)
-
numpy.ma.mask_cols()

2025-01-10 15:47:30
Please login to continue.