Get the categories stored in this data type
Description
Get the categories stored in this data type
Usage
<Expr>$cat$get_categories()
Value
A polars DataFrame with the categories for each categorical Series.
Examples
library("polars")
df = pl$DataFrame(
cats = factor(c("z", "z", "k", "a", "b")),
vals = factor(c(3, 1, 2, 2, 3))
)
df
#> shape: (5, 2)
#> ┌──────┬──────┐
#> │ cats ┆ vals │
#> │ --- ┆ --- │
#> │ cat ┆ cat │
#> ╞══════╪══════╡
#> │ z ┆ 3 │
#> │ z ┆ 1 │
#> │ k ┆ 2 │
#> │ a ┆ 2 │
#> │ b ┆ 3 │
#> └──────┴──────┘
#> shape: (4, 1)
#> ┌──────┐
#> │ cats │
#> │ --- │
#> │ str │
#> ╞══════╡
#> │ z │
#> │ k │
#> │ a │
#> │ b │
#> └──────┘
#> shape: (3, 1)
#> ┌──────┐
#> │ vals │
#> │ --- │
#> │ str │
#> ╞══════╡
#> │ 3 │
#> │ 1 │
#> │ 2 │
#> └──────┘