-
numpy.ma.filled(a, fill_value=None)
[source] -
Return input as an array with masked data replaced by a fill value.
If
a
is not aMaskedArray
,a
itself is returned. Ifa
is aMaskedArray
andfill_value
is None,fill_value
is set toa.fill_value
.Parameters: a : MaskedArray or array_like
An input object.
fill_value : scalar, optional
Filling value. Default is None.
Returns: a : ndarray
The filled array.
See also
Examples
1234567>>> x
=
np.ma.array(np.arange(
9
).reshape(
3
,
3
), mask
=
[[
1
,
0
,
0
],
... [
1
,
0
,
0
],
... [
0
,
0
,
0
]])
>>> x.filled()
array([[
999999
,
1
,
2
],
[
999999
,
4
,
5
],
[
6
,
7
,
8
]])
numpy.ma.filled()

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