putmask(a, mask, values)
Sets a.flat[n] = values[n]
for each n where mask.flat[n]==True
.
If :None:None:`values`
is not the same size as a
and :None:None:`mask`
then it will repeat. This gives behavior different from a[mask] = values
.
Target array.
Boolean mask array. It has to be the same shape as a
.
Values to put into a
where :None:None:`mask`
is True. If :None:None:`values`
is smaller than a
it will be repeated.
Changes elements of an array based on conditional and input values.
>>> x = np.arange(6).reshape(2, 3)
... np.putmask(x, x>2, x**2)
... x array([[ 0, 1, 2], [ 9, 16, 25]])
If :None:None:`values`
is smaller than a
it is repeated:
>>> x = np.arange(5)See :
... np.putmask(x, x>1, [-33, -44])
... x array([ 0, 1, -33, -44, -33])
The following pages refer to to this document either explicitly or contain code examples using this.
numpy.put
numpy.ma.core.putmask
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