place(arr, mask, vals)
Similar to np.copyto(arr, vals, where=mask)
, the difference is that place
uses the first N elements of :None:None:`vals`
, where N is the number of True values in :None:None:`mask`
, while copyto
uses the elements where :None:None:`mask`
is True.
Note that extract
does the exact opposite of place
.
Array to put data into.
Boolean mask array. Must have the same size as a
.
Values to put into a
. Only the first N elements are used, where N is the number of True values in :None:None:`mask`
. If :None:None:`vals`
is smaller than N, it will be repeated, and if elements of a
are to be masked, this sequence must be non-empty.
Change elements of an array based on conditional and input values.
>>> arr = np.arange(6).reshape(2, 3)See :
... np.place(arr, arr>2, [44, 55])
... arr array([[ 0, 1, 2], [44, 55, 44]])
The following pages refer to to this document either explicitly or contain code examples using this.
numpy.extract
numpy.put
numpy.place
numpy.core._multiarray_umath.putmask
numpy.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