with_columns_var#
- Pseudobulk.with_columns_var(*exprs, cell_types=None, excluded_cell_types=None, **named_exprs)[source]#
Equivalent to
df.with_columns()rom polars, but applied to each cell type’s var.- Parameters:
*exprs: Scalar
column(s) to add, 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 add, specified as keyword arguments. The columns will be renamed to the keyword used.
- Returns:
A new Pseudobulk dataset with var[cell_type]=var[cell_type].with_columns(*exprs, **named_exprs) for all cell types.
- Return type: