numpy.ma.choose(indices, choices, out=None, mode='raise')
[source]
Use an index array to construct a new array from a set of choices.
Given an array of integers and a set of n choice arrays, this method will create a new array that merges each of the choice arrays. Where a value in a
is i, the new array will have the value that choices[i] contains in the same place.
Parameters: |
|
---|---|
Returns: |
|
See also
choose
>>> choice = np.array([[1,1,1], [2,2,2], [3,3,3]]) >>> a = np.array([2, 1, 0]) >>> np.ma.choose(a, choice) masked_array(data=[3, 2, 1], mask=False, fill_value=999999)
© 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
https://docs.scipy.org/doc/numpy-1.17.0/reference/generated/numpy.ma.choose.html