bundles / numpy 2.4.4 / numpy / ma / core / putmask
function
numpy.ma.core:putmask
source: /numpy/ma/core.py:7535
Signature
def putmask(a, mask, values)Summary
Changes elements of an array based on conditional and input values.
Extended Summary
This is the masked array version of numpy.putmask, for details see numpy.putmask.
Notes
Using a masked array as values will not transform a ndarray into a MaskedArray.
Examples
import numpy as np arr = [[1, 2], [3, 4]] mask = [[1, 0], [0, 0]] x = np.ma.array(arr, mask=mask) np.ma.putmask(x, x < 4, 10*x) x x.data
See also
Aliases
numpy.ma.putmask