Class: Polars::StructExpr
- Inherits:
-
Object
- Object
- Polars::StructExpr
- Defined in:
- lib/polars/struct_expr.rb
Overview
Namespace for struct related expressions.
Instance Method Summary collapse
-
#[](item) ⇒ Expr
Retrieve one of the fields of this
Struct
as a new Series. -
#field(name) ⇒ Expr
Retrieve one of the fields of this
Struct
as a new Series. -
#rename_fields(names) ⇒ Expr
Rename the fields of the struct.
Instance Method Details
#[](item) ⇒ Expr
Retrieve one of the fields of this Struct
as a new Series.
15 16 17 18 19 20 21 22 23 |
# File 'lib/polars/struct_expr.rb', line 15 def [](item) if item.is_a?(::String) field(item) elsif item.is_a?(Integer) Utils.wrap_expr(_rbexpr.struct_field_by_index(item)) else raise ArgumentError, "expected type Integer or String, got #{item.class.name}" end end |
#field(name) ⇒ Expr
Retrieve one of the fields of this Struct
as a new Series.
56 57 58 |
# File 'lib/polars/struct_expr.rb', line 56 def field(name) Utils.wrap_expr(_rbexpr.struct_field_by_name(name)) end |
#rename_fields(names) ⇒ Expr
Rename the fields of the struct.
94 95 96 |
# File 'lib/polars/struct_expr.rb', line 94 def rename_fields(names) Utils.wrap_expr(_rbexpr.struct_rename_fields(names)) end |