polars.Series.describe#
- Series.describe(
- percentiles: Sequence[float] | float | None = (0.25, 0.5, 0.75),
- interpolation: RollingInterpolationMethod = 'nearest',
Quick summary statistics of a Series.
Series with mixed datatypes will return summary statistics for the datatype of the first value.
- Parameters:
- percentiles
One or more percentiles to include in the summary statistics (if the Series has a numeric dtype). All values must be in the range
[0, 1]
.- interpolation{‘nearest’, ‘higher’, ‘lower’, ‘midpoint’, ‘linear’}
Interpolation method used when calculating percentiles.
- Returns:
- DataFrame
Mapping with summary statistics of a Series.
Notes
The median is included by default as the 50% percentile.
Examples
>>> s = pl.Series([1, 2, 3, 4, 5]) >>> s.describe() shape: (9, 2) ┌────────────┬──────────┐ │ statistic ┆ value │ │ --- ┆ --- │ │ str ┆ f64 │ ╞════════════╪══════════╡ │ count ┆ 5.0 │ │ null_count ┆ 0.0 │ │ mean ┆ 3.0 │ │ std ┆ 1.581139 │ │ min ┆ 1.0 │ │ 25% ┆ 2.0 │ │ 50% ┆ 3.0 │ │ 75% ┆ 4.0 │ │ max ┆ 5.0 │ └────────────┴──────────┘
Non-numeric data types may not have all statistics available.
>>> s = pl.Series(["aa", "aa", None, "bb", "cc"]) >>> s.describe() shape: (4, 2) ┌────────────┬───────┐ │ statistic ┆ value │ │ --- ┆ --- │ │ str ┆ str │ ╞════════════╪═══════╡ │ count ┆ 4 │ │ null_count ┆ 1 │ │ min ┆ aa │ │ max ┆ cc │ └────────────┴───────┘