unstack

unstack(x: array, /, *, axis: int = 0) Tuple[array, ...]

Splits an array into a sequence of arrays along the given axis.

Parameters:
  • x (array) – input array.

  • axis (int) – axis along which to split an array. A valid axis must be an integer on the interval [-N, N), where N is the number of axes in x. If an axis is specified as a negative integer, the function must determine the axis along which to perform the operation by counting backward from the last axis (where -1 refers to the last axis). If provided an invalid axis, the function must raise an exception. Default: 0.

Returns:

out (Tuple[array, …]) – tuple of slices along the given dimension. Each returned array must have the same shape.

Notes

New in version 2023.12.