-
numpy.ma.is_masked(x)
[source] -
Determine whether input has masked values.
Accepts any object as input, but always returns False unless the input is a MaskedArray containing masked values.
Parameters: x : array_like
Array to check for masked values.
Returns: result : bool
True if
x
is a MaskedArray with masked values, False otherwise.Examples
123456789101112131415>>>
import
numpy.ma as ma
>>> x
=
ma.masked_equal([
0
,
1
,
0
,
2
,
3
],
0
)
>>> x
masked_array(data
=
[
-
-
1
-
-
2
3
],
mask
=
[
True
False
True
False
False
],
fill_value
=
999999
)
>>> ma.is_masked(x)
True
>>> x
=
ma.masked_equal([
0
,
1
,
0
,
2
,
3
],
42
)
>>> x
masked_array(data
=
[
0
1
0
2
3
],
mask
=
False
,
fill_value
=
999999
)
>>> ma.is_masked(x)
False
Always returns False if
x
isn?t a MaskedArray.123456>>> x
=
[
False
,
True
,
False
]
>>> ma.is_masked(x)
False
>>> x
=
'a string'
>>> ma.is_masked(x)
False
numpy.ma.is_masked()

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