Skip to contents

Summary statistics for a Polars DataFrame

Usage

describe(.data, percentiles = c(0.25, 0.75))

Arguments

.data

A Polars Data/LazyFrame

percentiles

One or more percentiles to include in the summary statistics. All values must be between 0 and 1 (NULL are ignored).

Examples

mtcars |>
  as_polars_df() |>
  describe(percentiles = c(0.2, 0.4, 0.6, 0.8))
#> shape: (11, 12)
#> ┌────────────┬───────────┬──────────┬────────────┬───┬──────────┬──────────┬──────────┬────────┐
#> │ statistic  ┆ mpg       ┆ cyl      ┆ disp       ┆ … ┆ vs       ┆ am       ┆ gear     ┆ carb   │
#> │ ---        ┆ ---       ┆ ---      ┆ ---        ┆   ┆ ---      ┆ ---      ┆ ---      ┆ ---    │
#> │ str        ┆ f64       ┆ f64      ┆ f64        ┆   ┆ f64      ┆ f64      ┆ f64      ┆ f64    │
#> ╞════════════╪═══════════╪══════════╪════════════╪═══╪══════════╪══════════╪══════════╪════════╡
#> │ count      ┆ 32.0      ┆ 32.0     ┆ 32.0       ┆ … ┆ 32.0     ┆ 32.0     ┆ 32.0     ┆ 32.0   │
#> │ null_count ┆ 0.0       ┆ 0.0      ┆ 0.0        ┆ … ┆ 0.0      ┆ 0.0      ┆ 0.0      ┆ 0.0    │
#> │ mean       ┆ 20.090625 ┆ 6.1875   ┆ 230.721875 ┆ … ┆ 0.4375   ┆ 0.40625  ┆ 3.6875   ┆ 2.8125 │
#> │ std        ┆ 6.026948  ┆ 1.785922 ┆ 123.938694 ┆ … ┆ 0.504016 ┆ 0.498991 ┆ 0.737804 ┆ 1.6152 │
#> │ min        ┆ 10.4      ┆ 4.0      ┆ 71.1       ┆ … ┆ 0.0      ┆ 0.0      ┆ 3.0      ┆ 1.0    │
#> │ …          ┆ …         ┆ …        ┆ …          ┆ … ┆ …        ┆ …        ┆ …        ┆ …      │
#> │ 40%        ┆ 17.8      ┆ 6.0      ┆ 160.0      ┆ … ┆ 0.0      ┆ 0.0      ┆ 3.0      ┆ 2.0    │
#> │ 50%        ┆ 19.2      ┆ 6.0      ┆ 225.0      ┆ … ┆ 0.0      ┆ 0.0      ┆ 4.0      ┆ 2.0    │
#> │ 60%        ┆ 21.0      ┆ 8.0      ┆ 275.8      ┆ … ┆ 1.0      ┆ 1.0      ┆ 4.0      ┆ 3.0    │
#> │ 80%        ┆ 24.4      ┆ 8.0      ┆ 351.0      ┆ … ┆ 1.0      ┆ 1.0      ┆ 4.0      ┆ 4.0    │
#> │ max        ┆ 33.9      ┆ 8.0      ┆ 472.0      ┆ … ┆ 1.0      ┆ 1.0      ┆ 5.0      ┆ 8.0    │
#> └────────────┴───────────┴──────────┴────────────┴───┴──────────┴──────────┴──────────┴────────┘