Summary Statistics¶
Summary statistics calculations with segmentation support.
summary ¶
Summary statistics helper functions.
This module provides convenient helper functions for summary statistical calculations.
mean ¶
mean(
name: str,
dataset: LazyFrame | DataFrame,
variable: str,
segment: list[str] | None = None,
) -> pl.DataFrame
Calculate the mean summary for the given dataset and parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the metric. |
required |
dataset
|
LazyFrame | DataFrame
|
Dataset to compute the mean on. |
required |
variable
|
str
|
Column name for which to compute the mean. |
required |
segment
|
list[str] | None
|
Segmentation groups for calculation. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame containing the mean summary and associated metadata. |
median ¶
median(
name: str,
dataset: LazyFrame | DataFrame,
variable: str,
segment: list[str] | None = None,
) -> pl.DataFrame
Calculate the median summary for the given dataset and parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the metric. |
required |
dataset
|
LazyFrame | DataFrame
|
Dataset to compute the median on. |
required |
variable
|
str
|
Column name for which to compute the median. |
required |
segment
|
list[str] | None
|
Segmentation groups for calculation. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame containing the median summary and associated metadata. |
options: show_source: false heading_level: 2 members_order: source