take

sparse.take(x, indices, /, *, axis=None)[source]

Returns elements of an array along an axis.

Parameters:
  • x (SparseArray) – Input array.

  • indices (ndarray) – Array indices. The array must be one-dimensional and have an integer data type.

  • axis (int) – Axis over which to select values. If axis is negative, the function must determine the axis along which to select values by counting from the last dimension. For None, the flattened input array is used. Default: None.

Returns:

out – A COO array with requested indices.

Return type:

COO

Raises:

ValueError – If the input array isn’t and can’t be converted to COO format.