polars.Series.describe#

Series.describe(percentiles: Sequence[float] | float | None = (0.25, 0.75)) DataFrame[source]#

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].

Returns:
DataFrame

Mapping with summary statistics of a Series.

Examples

>>> series_num = pl.Series([1, 2, 3, 4, 5])
>>> series_num.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      │
└────────────┴──────────┘
>>> series_str = pl.Series(["a", "a", None, "b", "c"])
>>> series_str.describe()
shape: (3, 2)
┌────────────┬───────┐
│ statistic  ┆ value │
│ ---        ┆ ---   │
│ str        ┆ i64   │
╞════════════╪═══════╡
│ count      ┆ 5     │
│ null_count ┆ 1     │
│ unique     ┆ 4     │
└────────────┴───────┘