select_obs#

Pseudobulk.select_obs(*exprs, cell_types=None, excluded_cell_types=None, **named_exprs)[source]#

Equivalent to df.select() from polars, but applied to each cell type’s obs. obs_names will be automatically included as the first column, if not included explicitly.

Parameters:
  • *exprs: Scalar

    column(s) to select, specified as positional arguments. Accepts expression input. Strings are parsed as column names, other non-expression inputs are parsed as literals.

  • 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

  • **named_exprs: Scalar

    additional columns to select, specified as keyword arguments. The columns will be renamed to the keyword used.

Returns:

A new Pseudobulk dataset with obs[cell_type]=obs[cell_type].select(*exprs, **named_exprs) for all cell types in obs, and obs_names as the first column unless already included explicitly.

Return type:

Pseudobulk