Class: Polars::CatExpr

Inherits:
Object
  • Object
show all
Defined in:
lib/polars/cat_expr.rb

Overview

Namespace for categorical related expressions.

Instance Method Summary collapse

Instance Method Details

#get_categoriesExpr

Get the categories stored in this data type.

Examples:

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

Returns:



32
33
34
# File 'lib/polars/cat_expr.rb', line 32

def get_categories
  Utils.wrap_expr(_rbexpr.cat_get_categories)
end