numpy.select(condlist, choicelist, default=0)
[source]
Return an array drawn from elements in choicelist, depending on conditions.
Parameters: |
|
---|---|
Returns: |
|
See also
where
>>> x = np.arange(10) >>> condlist = [x<3, x>5] >>> choicelist = [x, x**2] >>> np.select(condlist, choicelist) array([ 0, 1, 2, ..., 49, 64, 81])
© 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
https://docs.scipy.org/doc/numpy-1.17.0/reference/generated/numpy.select.html