Skip to main content

concatenate

Join a sequence of arrays along an existing axis. All arrays must have the same shape except along the concatenation axis. concat is an alias for concatenate.
Returns: NDArray — The concatenated array.

stack

Join a sequence of arrays along a new axis. All input arrays must have the same shape.
Returns: NDArray — The stacked array with one additional dimension.

vstack

Stack arrays vertically (row-wise). 1-D arrays of shape (N,) are first reshaped to (1, N). Equivalent to concatenate along axis 0 after that reshape. row_stack is an alias for vstack.
Returns: NDArray — The vertically stacked array.

hstack

Stack arrays horizontally (column-wise). For 1-D arrays, concatenates along axis 0. For 2-D and higher arrays, concatenates along axis 1.
Returns: NDArray — The horizontally stacked array.

dstack

Stack arrays depth-wise (along the third axis). 1-D arrays (N,) are reshaped to (1, N, 1) and 2-D arrays (M, N) to (M, N, 1) before stacking.
Returns: NDArray — The depth-stacked array (at least 3-D).

column_stack

Stack 1-D arrays as columns into a 2-D array. 1-D inputs are first reshaped to column vectors (N, 1), then horizontally stacked. 2-D and higher arrays are passed through to hstack unchanged.
Returns: NDArray — 2-D array with each 1-D input as a column.

block

Assemble an array from nested sequences of blocks. For a flat list of N-D arrays, concatenates along the last axis.
Returns: NDArray — The assembled array.

append

Append values to the end of an array. When no axis is given, both arrays are flattened before concatenation.
Returns: NDArray — A copy of arr with values appended.

insert

Insert values into an array before specified indices.
Returns: NDArray — A copy of arr with values inserted.