concatenate
Join a sequence of arrays along an existing axis. All arrays must have the same shape except along the concatenation axis. The result dtype is the promotion of all input dtypes, not the first input’s dtype:int32 with float32 gives float64, as in NumPy. The same holds for stack, vstack, hstack, dstack, column_stack, block, and append.
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. Input dtypes are promoted to a common dtype.
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.
Input dtypes are promoted to a common dtype.
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. Input dtypes are promoted to a common dtype.
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.
Input dtypes are promoted to a common dtype.
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.
Input dtypes are promoted to a common dtype.
Returns:
NDArray — 2-D array with each 1-D input as a column.
block
Assemble an array from nested sequences of blocks. Each level of nesting concatenates along a different axis: the innermost list concatenates along axis-1, the next level along axis -2, and so on outward (matching NumPy’s semantics).
Dtypes are promoted at each nesting level, as in NumPy.
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. The result dtype is the promotion of the dtypes ofarr and values.
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.