map_var#

Pseudobulk.map_var(function, /, *args, cell_types=None, excluded_cell_types=None, **kwargs)[source]#

Apply a function to each cell type’s var.

To apply a function to var as a whole, rather than each cell type’s var, use pipe_var().

Parameters:
  • function : Callable[[DataFrame, ...], DataFrame]

    the function to apply to each cell type’s var. It must take the old var for a cell type and return the new var. The function may also take other arguments after var, which can be specified via args and kwargs.

  • *args : Any

    the positional arguments to the function

  • cell_types : str | Iterable[str] | None

    one or more cell types to operate on; if None, operate on all cell types. Mutually exclusive with excluded_cell_types.

  • excluded_cell_types : str | Iterable[str] | None

    one or more cell types to exclude from the operation; mutually exclusive with cell_types

  • **kwargs : Any

    the keyword arguments to the function

Returns:

A new Pseudobulk dataset where the function has been applied to each cell type’s var.

Return type:

Pseudobulk