Class: Polars::MetaExpr
- Inherits:
-
Object
- Object
- Polars::MetaExpr
- Defined in:
- lib/polars/meta_expr.rb
Overview
Namespace for expressions on a meta level.
Instance Method Summary collapse
-
#!=(other) ⇒ Boolean
Not equal.
-
#==(other) ⇒ Boolean
Equal.
-
#as_selector ⇒ Expr
Try to turn this expression in a selector.
-
#eq(other) ⇒ Boolean
Indicate if this expression is the same as another expression.
-
#has_multiple_outputs ⇒ Boolean
Indicate if this expression expands into multiple expressions.
-
#is_column ⇒ Boolean
Indicate if this expression is a basic (non-regex) unaliased column.
-
#is_column_selection(allow_aliasing: false) ⇒ Boolean
Indicate if this expression only selects columns (optionally with aliasing).
-
#is_literal(allow_aliasing: false) ⇒ Boolean
Indicate if this expression is a literal value (optionally aliased).
-
#is_regex_projection ⇒ Boolean
Indicate if this expression expands to columns that match a regex pattern.
-
#ne(other) ⇒ Boolean
Indicate if this expression is NOT the same as another expression.
-
#output_name ⇒ String
Get the column name that this expression would produce.
-
#pop(schema: nil) ⇒ Array
Pop the latest expression and return the input(s) of the popped expression.
-
#root_names ⇒ Array
Get a list with the root column name.
-
#tree_format(return_as_string: false, schema: nil) ⇒ String
Format the expression as a tree.
-
#undo_aliases ⇒ Expr
Undo any renaming operation like
alias
orkeep_name
.
Instance Method Details
#!=(other) ⇒ Boolean
Not equal.
22 23 24 |
# File 'lib/polars/meta_expr.rb', line 22 def !=(other) !(self == other) end |
#==(other) ⇒ Boolean
Equal.
15 16 17 |
# File 'lib/polars/meta_expr.rb', line 15 def ==(other) _rbexpr.(other._rbexpr) end |
#as_selector ⇒ Expr
This functionality is considered unstable. It may be changed at any point without it being considered a breaking change.
Try to turn this expression in a selector.
Raises if the underlying expressions is not a column or selector.
247 248 249 |
# File 'lib/polars/meta_expr.rb', line 247 def as_selector Selector._from_rbselector(_rbexpr.into_selector) end |
#eq(other) ⇒ Boolean
Indicate if this expression is the same as another expression.
38 39 40 |
# File 'lib/polars/meta_expr.rb', line 38 def eq(other) _rbexpr.(other._rbexpr) end |
#has_multiple_outputs ⇒ Boolean
Indicate if this expression expands into multiple expressions.
66 67 68 |
# File 'lib/polars/meta_expr.rb', line 66 def has_multiple_outputs _rbexpr. end |
#is_column ⇒ Boolean
Indicate if this expression is a basic (non-regex) unaliased column.
84 85 86 |
# File 'lib/polars/meta_expr.rb', line 84 def is_column _rbexpr. end |
#is_column_selection(allow_aliasing: false) ⇒ Boolean
Indicate if this expression only selects columns (optionally with aliasing).
This can include bare columns, columns matched by regex or dtype, selectors and exclude ops, and (optionally) column/expression aliasing.
139 140 141 |
# File 'lib/polars/meta_expr.rb', line 139 def is_column_selection(allow_aliasing: false) _rbexpr.(allow_aliasing) end |
#is_literal(allow_aliasing: false) ⇒ Boolean
Indicate if this expression is a literal value (optionally aliased).
160 161 162 |
# File 'lib/polars/meta_expr.rb', line 160 def is_literal(allow_aliasing: false) _rbexpr.(allow_aliasing) end |
#is_regex_projection ⇒ Boolean
Indicate if this expression expands to columns that match a regex pattern.
96 97 98 |
# File 'lib/polars/meta_expr.rb', line 96 def is_regex_projection _rbexpr. end |
#ne(other) ⇒ Boolean
Indicate if this expression is NOT the same as another expression.
54 55 56 |
# File 'lib/polars/meta_expr.rb', line 54 def ne(other) !eq(other) end |
#output_name ⇒ String
Get the column name that this expression would produce.
183 184 185 |
# File 'lib/polars/meta_expr.rb', line 183 def output_name _rbexpr. end |
#pop(schema: nil) ⇒ Array
Pop the latest expression and return the input(s) of the popped expression.
198 199 200 |
# File 'lib/polars/meta_expr.rb', line 198 def pop(schema: nil) _rbexpr.(schema).map { |e| Utils.wrap_expr(e) } end |
#root_names ⇒ Array
Get a list with the root column name.
219 220 221 |
# File 'lib/polars/meta_expr.rb', line 219 def root_names _rbexpr. end |
#tree_format(return_as_string: false, schema: nil) ⇒ String
Format the expression as a tree.
261 262 263 264 265 266 267 268 269 |
# File 'lib/polars/meta_expr.rb', line 261 def tree_format(return_as_string: false, schema: nil) s = _rbexpr.(schema) if return_as_string s else puts s nil end end |
#undo_aliases ⇒ Expr
Undo any renaming operation like alias
or keep_name
.
234 235 236 |
# File 'lib/polars/meta_expr.rb', line 234 def undo_aliases Utils.wrap_expr(_rbexpr.) end |