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

bundles / numpy latest / numpy / ma / core / putmask

function

numpy.ma.core:putmask

source: build-install/usr/lib/python3.14/site-packages/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

numpy.putmask

Aliases

  • numpy.ma.putmask