This is a pre-release version (latest). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy latest / numpy / ma / core / put

function

numpy.ma.core:put

source: build-install/usr/lib/python3.14/site-packages/numpy/ma/core.py :7494

Signature

def   put ( a indices values mode = raise )

Summary

Set storage-indexed locations to corresponding values.

Extended Summary

This function is equivalent to MaskedArray.put, see that method for details.

Examples

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
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

See also

MaskedArray.put

Aliases

  • numpy.ma.put