blosc2.stack#

blosc2.stack(arrays: list[NDArray], axis=0, **kwargs: Any) NDArray#

Stack multiple arrays, creating a new axis.

Parameters:
  • arrays (list of NDArray) – A list containing two or more NDArray instances to be stacked.

  • axis (int, optional) – The new axis along which the arrays will be stacked. Default is 0.

  • kwargs (dict, optional) – Keyword arguments that are supported by the empty() constructor.

Returns:

out – A new NDArray containing the stacked data.

Return type:

NDArray

Examples

>>> import blosc2
>>> import numpy as np
>>> arr1 = blosc2.arange(0, 6, dtype=np.int32, shape=(2,3))
>>> arr2 = blosc2.arange(6, 12, dtype=np.int32, shape=(2,3))
>>> result = blosc2.stack([arr1, arr2])
>>> print(result.shape)
(2, 2, 3)