treedata.concat

Contents

treedata.concat#

treedata.concat(tdatas, *, axis='obs', join='inner', merge=None, uns_merge=None, label=None, keys=None, fill_value=None, pairwise=False)#

Concatenates TreeData objects along an axis.

Parameters:
  • tdatas (Union[Collection[TreeData], Mapping[str, TreeData]]) – The objects to be concatenated. If a Mapping is passed, keys are used for the keys argument and values are concatenated.

  • axis (Literal['obs', 0, 'var', 1] (default: 'obs')) – Which axis to concatenate along.

  • join (Literal['inner', 'outer'] (default: 'inner')) – How to align values when concatenating. If “outer”, the union of the other axis is taken. If “inner”, the intersection. for more.

  • merge (Union[Literal['same', 'unique', 'first', 'only'], Callable, None] (default: None)) –

    How elements not aligned to the axis being concatenated along are selected. Currently implemented strategies include:

    • None: No elements are kept.

    • "same": Elements that are the same in each of the objects.

    • "unique": Elements for which there is only one possible value.

    • "first": The first element seen at each from each position.

    • "only": Elements that show up in only one of the objects.

  • uns_merge (Union[Literal['same', 'unique', 'first', 'only'], Callable, None] (default: None)) – How the elements of .uns are selected. Uses the same set of strategies as the merge argument, except applied recursively.

  • label (str | None (default: None)) – Column in axis annotation (i.e. .obs or .var) to place batch information in. If it’s None, no column is added.

  • keys (Collection | None (default: None)) – Names for each object being added. These values are used for column values for label or appended to the index if index_unique is not None. Defaults to incrementing integer labels.

  • fill_value (Any | None (default: None)) – When join="outer", this is the value that will be used to fill the introduced indices. By default, sparse arrays are padded with zeros, while dense arrays and DataFrames are padded with missing values.

  • pairwise (bool (default: False)) – Whether pairwise elements along the concatenated dimension should be included. This is False by default, since the resulting arrays are often not meaningful.

Return type:

TreeData