polars.Expr.cat.get_categories#

Expr.cat.get_categories() Expr[source]#

Get the categories stored in this data type.

Examples

>>> df = pl.Series(
...     "cats", ["foo", "bar", "foo", "foo", "ham"], dtype=pl.Categorical
... ).to_frame()
>>> df.select(pl.col("cats").cat.get_categories())
shape: (3, 1)
┌──────┐
│ cats │
│ ---  │
│ str  │
╞══════╡
│ foo  │
│ bar  │
│ ham  │
└──────┘