Set storage-indexed locations to corresponding values.
This function is equivalent to MaskedArray.put, see that method for details.
See also
Putting values in a masked array:
>>> a = np.ma.array([1, 2, 3, 4], mask=[False, True, False, False])
>>> np.ma.put(a, [1, 3], [10, 30])
>>> a
masked_array(data=[ 1, 10, 3, 30],
mask=False,
fill_value=999999)
Using put with a 2D array:
>>> b = np.ma.array([[1, 2], [3, 4]], mask=[[False, True], [False, False]])
>>> np.ma.put(b, [[0, 1], [1, 0]], [[10, 20], [30, 40]])
>>> b
masked_array(
data=[[40, 30],
[ 3, 4]],
mask=False,
fill_value=999999)
© 2005–2024 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/2.4/reference/generated/numpy.ma.put.html