stats.summary

summary

summary(data: DataInput | DataSource, columns: list[str] | tuple[str, ...], *, by: str | None = None, max_categories: int = 20, max_groups: int = 50) -> pl.DataFrame

Tidy descriptive summaries, with grouped numeric metrics in one query.

Grouping executes one aggregated scan per numeric variable, instead of one scan per group. Categorical values use one bounded crosstab.

Example

table = ps.stats.summary(df, ['age', 'enctype'], by='cohort')

← Statistics and diagnostics API