Class: Polars::NameExpr
- Inherits:
-
Object
- Object
- Polars::NameExpr
- Defined in:
- lib/polars/name_expr.rb
Overview
Namespace for expressions that operate on expression names.
Instance Method Summary collapse
-
#keep ⇒ Expr
Keep the original root name of the expression.
-
#map(&function) ⇒ Expr
Rename the output of an expression by mapping a function over the root name.
-
#map_fields(&function) ⇒ Expr
Rename fields of a struct by mapping a function over the field name(s).
-
#prefix(prefix) ⇒ Expr
Add a prefix to the root column name of the expression.
-
#prefix_fields(prefix) ⇒ Expr
Add a prefix to all field names of a struct.
-
#replace(pattern, value, literal: false) ⇒ Expr
Replace matching regex/literal substring in the name with a new value.
-
#suffix(suffix) ⇒ Expr
Add a suffix to the root column name of the expression.
-
#suffix_fields(suffix) ⇒ Expr
Add a suffix to all field names of a struct.
-
#to_lowercase ⇒ Expr
Make the root column name lowercase.
-
#to_uppercase ⇒ Expr
Make the root column name uppercase.
Instance Method Details
#keep ⇒ Expr
Due to implementation constraints, this method can only be called as the last expression in a chain.
Keep the original root name of the expression.
51 52 53 |
# File 'lib/polars/name_expr.rb', line 51 def keep Utils.wrap_expr(_rbexpr.name_keep) end |
#map(&function) ⇒ Expr
Rename the output of an expression by mapping a function over the root name.
80 81 82 |
# File 'lib/polars/name_expr.rb', line 80 def map(&function) Utils.wrap_expr(_rbexpr.name_map(function)) end |
#map_fields(&function) ⇒ Expr
This only takes effect for struct columns.
Rename fields of a struct by mapping a function over the field name(s).
209 210 211 |
# File 'lib/polars/name_expr.rb', line 209 def map_fields(&function) Utils.wrap_expr(_rbexpr.name_map_fields(function)) end |
#prefix(prefix) ⇒ Expr
Add a prefix to the root column name of the expression.
110 111 112 |
# File 'lib/polars/name_expr.rb', line 110 def prefix(prefix) Utils.wrap_expr(_rbexpr.name_prefix(prefix)) end |
#prefix_fields(prefix) ⇒ Expr
This only takes effect for struct columns.
Add a prefix to all field names of a struct.
227 228 229 |
# File 'lib/polars/name_expr.rb', line 227 def prefix_fields(prefix) Utils.wrap_expr(_rbexpr.name_prefix_fields(prefix)) end |
#replace(pattern, value, literal: false) ⇒ Expr
Replace matching regex/literal substring in the name with a new value.
261 262 263 |
# File 'lib/polars/name_expr.rb', line 261 def replace(pattern, value, literal: false) Utils.wrap_expr(_rbexpr.name_replace(pattern, value, literal)) end |
#suffix(suffix) ⇒ Expr
Add a suffix to the root column name of the expression.
140 141 142 |
# File 'lib/polars/name_expr.rb', line 140 def suffix(suffix) Utils.wrap_expr(_rbexpr.name_suffix(suffix)) end |
#suffix_fields(suffix) ⇒ Expr
This only takes effect for struct columns.
Add a suffix to all field names of a struct.
279 280 281 |
# File 'lib/polars/name_expr.rb', line 279 def suffix_fields(suffix) Utils.wrap_expr(_rbexpr.name_suffix_fields(suffix)) end |
#to_lowercase ⇒ Expr
Make the root column name lowercase.
167 168 169 |
# File 'lib/polars/name_expr.rb', line 167 def to_lowercase Utils.wrap_expr(_rbexpr.name_to_lowercase) end |
#to_uppercase ⇒ Expr
Make the root column name uppercase.
194 195 196 |
# File 'lib/polars/name_expr.rb', line 194 def to_uppercase Utils.wrap_expr(_rbexpr.name_to_uppercase) end |