stack_la

stack_la(arrays: tuple[LabeledArray, ...], new_labels: list[str, ...]) LabeledArray[source][source]

Stack a sequence of LabeledArrays along a new axis.

Parameters:
  • arrays (LabeledArray) – The LabeledArrays to stack.

  • new_labels (Labels) – The new labels for the stacked axis.

Returns:

The stacked LabeledArray.

Return type:

LabeledArray

Examples

>>> arr1 = LabeledArray([[1, 2],[3, 4]], labels=[('a', 'b'), ('c', 'd')])
>>> arr2 = LabeledArray([[5, 6, 7],[7, 8, 9]],
... labels=[('a', 'b'), ('c', 'd', 'e')])
>>> stack_la((arr1, arr2), ['1', '2'])
array([[[ 1.,  2., nan],
        [ 3.,  4., nan]],

       [[ 5.,  6.,  7.],
        [ 7.,  8.,  9.]]])
labels(['1', '2']
       ['a', 'b']
       ['c', 'd', 'e'])