numpy 1.22.4 Pypi GitHub Homepage
Other Docs
NotesParametersBackRef
put(self, indices, values, mode='raise')

Sets self._data.flat[n] = values[n] for each n in indices. If :None:None:`values` is shorter than indices then it will repeat. If :None:None:`values` has some masked values, the initial mask is updated in consequence, else the corresponding values are unmasked.

Notes

:None:None:`values` can be a scalar or length 1 array.

Parameters

indices : 1-D array_like

Target indices, interpreted as integers.

values : array_like

Values to place in self._data copy at target indices.

mode : {'raise', 'wrap', 'clip'}, optional

Specifies how out-of-bounds indices will behave. 'raise' : raise an error. 'wrap' : wrap around. 'clip' : clip to the range.

Set storage-indexed locations to corresponding values.

Examples

This example is valid syntax, but we were not able to check execution
>>> x = np.ma.array([[1,2,3],[4,5,6],[7,8,9]], mask=[0] + [1,0]*4)
... x masked_array( data=[[1, --, 3], [--, 5, --], [7, --, 9]], mask=[[False, True, False], [ True, False, True], [False, True, False]], fill_value=999999)
This example is valid syntax, but we were not able to check execution
>>> x.put([0,4,8],[10,20,30])
... x masked_array( data=[[10, --, 3], [--, 20, --], [7, --, 30]], mask=[[False, True, False], [ True, False, True], [False, True, False]], fill_value=999999)
This example is valid syntax, but we were not able to check execution
>>> x.put(4,999)
... x masked_array( data=[[10, --, 3], [--, 999, --], [7, --, 30]], mask=[[False, True, False], [ True, False, True], [False, True, False]], fill_value=999999)
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.ma.core.put

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/ma/core.py#4680
type: <class 'function'>
Commit: