pipe_var#

SingleCell.pipe_var(function, /, *args, **kwargs)[source]#

Apply a function to a SingleCell dataset’s var.

sc = sc.pipe_var(func) is equivalent to sc.var = func(sc.var). sc = sc.pipe_var(func, 1, a=2) is equivalent to sc.var = func(sc.var, 1, a=2).

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

    the function to apply to var. It must take the old var as its first argument 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

  • **kwargs: Any

    the keyword arguments to the function

Returns:

A new SingleCell dataset where the function has been applied to var.

Return type:

SingleCell