Class: Polars::Categorical
- Defined in:
- lib/polars/data_types.rb
Overview
A categorical encoding of a set of strings.
Instance Attribute Summary collapse
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#ordering ⇒ Object
readonly
Returns the value of attribute ordering.
Instance Method Summary collapse
-
#initialize(ordering = "physical", **kwargs) ⇒ Categorical
constructor
A new instance of Categorical.
Constructor Details
#initialize(ordering = "physical", **kwargs) ⇒ Categorical
Returns a new instance of Categorical.
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
# File 'lib/polars/data_types.rb', line 343 def initialize(ordering = "physical", **kwargs) if ordering.is_a?(Categories) @ordering = "lexical" @categories = ordering # assert kwargs.length == 0 return end @ordering = "lexical" if kwargs[:categories] # assert kwargs.length == 1 @categories = kwargs[:categories] else # assert kwargs.length == 0 @categories = Categories.new end end |
Instance Attribute Details
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
341 342 343 |
# File 'lib/polars/data_types.rb', line 341 def categories @categories end |
#ordering ⇒ Object (readonly)
Returns the value of attribute ordering.
341 342 343 |
# File 'lib/polars/data_types.rb', line 341 def ordering @ordering end |