select(condlist, choicelist, default=0)
The list of conditions which determine from which array in :None:None:`choicelist`
the output elements are taken. When multiple conditions are satisfied, the first one encountered in :None:None:`condlist`
is used.
The list of arrays from which the output elements are taken. It has to be of the same length as :None:None:`condlist`
.
The element inserted in output
when all conditions evaluate to False.
The output at position m is the m-th element of the array in :None:None:`choicelist`
where the m-th element of the corresponding array in :None:None:`condlist`
is True.
Return an array drawn from elements in choicelist, depending on conditions.
where
Return elements from one of two arrays depending on condition.
>>> x = np.arange(6)
... condlist = [x<3, x>3]
... choicelist = [x, x**2]
... np.select(condlist, choicelist, 42) array([ 0, 1, 2, 42, 16, 25])
>>> condlist = [x<=4, x>3]See :
... choicelist = [x, x**2]
... np.select(condlist, choicelist, 55) array([ 0, 1, 2, 3, 4, 25])
The following pages refer to to this document either explicitly or contain code examples using this.
numpy.piecewise
dask.array.routines.select
numpy.compress
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