split
Split an array into multiple equal-length sub-arrays along an axis. WhenindicesOrSections is an integer, the array must be evenly divisible along that axis (use array_split for unequal splits). Returns views into the original array.
| Name | Type | Default | Description |
|---|---|---|---|
a | ArrayLike | — | Input array. |
indicesOrSections | number | number[] | — | If an integer N, split into N equal parts. If an array of indices, split at those positions. |
axis | number | 0 | Axis along which to split. |
NDArray[] — List of sub-arrays as views.
array_split
Split an array into multiple sub-arrays. Unlikesplit, array_split allows splitting into sections of unequal size when the axis length is not evenly divisible. Returns views.
| Name | Type | Default | Description |
|---|---|---|---|
a | ArrayLike | — | Input array. |
indicesOrSections | number | number[] | — | If an integer N, split into N parts (first size % N sections get one extra element). If an array of indices, split at those positions. |
axis | number | 0 | Axis along which to split. |
NDArray[] — List of sub-arrays as views.
hsplit
Split an array horizontally (column-wise). For 1-D arrays, splits along axis 0. For 2-D and higher, splits along axis 1. Returns views.| Name | Type | Default | Description |
|---|---|---|---|
a | ArrayLike | — | Input array with at least 1 dimension. |
indicesOrSections | number | number[] | — | Number of equal splits or array of split indices. |
NDArray[] — List of sub-arrays.
vsplit
Split an array vertically (row-wise) along axis 0. The input must have at least 2 dimensions. Returns views.| Name | Type | Default | Description |
|---|---|---|---|
a | ArrayLike | — | Input array with at least 2 dimensions. |
indicesOrSections | number | number[] | — | Number of equal splits or array of split indices. |
NDArray[] — List of sub-arrays.
dsplit
Split an array depth-wise (along the third axis). The input must have at least 3 dimensions. Returns views.| Name | Type | Default | Description |
|---|---|---|---|
ary | ArrayLike | — | Input array with at least 3 dimensions. |
indices_or_sections | number | number[] | — | Number of equal splits or array of split indices. |
NDArray[] — List of sub-arrays.
unstack
Unstack an array along an axis, producing a list of arrays each with one fewer dimension. This is the inverse ofstack.
| Name | Type | Default | Description |
|---|---|---|---|
a | ArrayLike | — | Input array. |
axis | number | 0 | Axis along which to unstack. |
NDArray[] — List of sub-arrays with the specified axis removed.