arsenal.numpy

Module Contents

arsenal.numpy.select(xs: np.ndarray, xs_ids: np.ndarray, selection_ids: np.ndarray) → np.ndarray[source]
Parameters
  • xs – Array to select elements from

  • xs_ids – Array of ids for each element in xs

  • selection_ids – Array of ids to select

Returns

A selection of elements from xs

Examples

>>> select(            np.array([1, 2, 3]),             np.array(['a', 'b', 'c']),             np.array(['a'])         )
array([1])
>>> select(            np.array([1, 2, 3]),             np.array(['a', 'b', 'c']),             np.array(['a', 'c'])         )
array([1, 3])
>>> select(            np.array([1, 2, 3]),             np.array(['a', 'b', 'c']),             np.array(['a', 'c', 'a'])         )
array([1, 3, 1])