Class: Polars::Expr
- Inherits:
-
Object
- Object
- Polars::Expr
- Defined in:
- lib/polars/expr.rb
Overview
Expressions that can be used in various contexts.
Direct Known Subclasses
Instance Method Summary collapse
-
#! ⇒ Expr
(also: #~)
Performs boolean not.
-
#!=(other) ⇒ Expr
Not equal.
-
#%(other) ⇒ Expr
Returns the modulo.
-
#&(other) ⇒ Expr
Bitwise AND.
-
#*(other) ⇒ Expr
Performs multiplication.
-
#**(power) ⇒ Expr
Raises to the power of exponent.
-
#+(other) ⇒ Expr
Performs addition.
-
#-(other) ⇒ Expr
Performs subtraction.
-
#-@ ⇒ Expr
Performs negation.
-
#/(other) ⇒ Expr
Performs division.
-
#<(other) ⇒ Expr
Less than.
-
#<=(other) ⇒ Expr
Less than or equal.
-
#==(other) ⇒ Expr
Equal.
-
#>(other) ⇒ Expr
Greater than.
-
#>=(other) ⇒ Expr
Greater than or equal.
-
#^(other) ⇒ Expr
Bitwise XOR.
-
#_hash(seed = 0, seed_1 = nil, seed_2 = nil, seed_3 = nil) ⇒ Expr
Hash the elements in the selection.
-
#abs ⇒ Expr
Compute absolute values.
-
#add(other) ⇒ Expr
Method equivalent of addition operator
expr + other
. -
#agg_groups ⇒ Expr
Get the group indexes of the group by operation.
-
#alias(name) ⇒ Expr
Rename the output of an expression.
-
#all(drop_nulls: true) ⇒ Boolean
Check if all boolean values in a Boolean column are
true
. -
#and_(*others) ⇒ Expr
Method equivalent of bitwise "and" operator
expr & other & ...
. -
#any(drop_nulls: true) ⇒ Boolean
Check if any boolean value in a Boolean column is
true
. -
#append(other, upcast: true) ⇒ Expr
Append expressions.
-
#approx_n_unique ⇒ Expr
(also: #approx_unique)
Approx count unique values.
-
#arccos ⇒ Expr
Compute the element-wise value for the inverse cosine.
-
#arccosh ⇒ Expr
Compute the element-wise value for the inverse hyperbolic cosine.
-
#arcsin ⇒ Expr
Compute the element-wise value for the inverse sine.
-
#arcsinh ⇒ Expr
Compute the element-wise value for the inverse hyperbolic sine.
-
#arctan ⇒ Expr
Compute the element-wise value for the inverse tangent.
-
#arctanh ⇒ Expr
Compute the element-wise value for the inverse hyperbolic tangent.
-
#arg_max ⇒ Expr
Get the index of the maximal value.
-
#arg_min ⇒ Expr
Get the index of the minimal value.
-
#arg_sort(reverse: false, nulls_last: false) ⇒ Expr
Get the index values that would sort this column.
-
#arg_true ⇒ Expr
Return indices where expression evaluates
true
. -
#arg_unique ⇒ Expr
Get index of first unique value.
-
#argsort(reverse: false, nulls_last: false) ⇒ expr
Get the index values that would sort this column.
-
#arr ⇒ ArrayExpr
Create an object namespace of all array related methods.
-
#backward_fill(limit: nil) ⇒ Expr
Fill missing values with the next to be seen values.
-
#bin ⇒ BinaryExpr
Create an object namespace of all binary related methods.
-
#bitwise_and ⇒ Expr
Perform an aggregation of bitwise ANDs.
-
#bitwise_count_ones ⇒ Expr
Evaluate the number of set bits.
-
#bitwise_count_zeros ⇒ Expr
Evaluate the number of unset bits.
-
#bitwise_leading_ones ⇒ Expr
Evaluate the number most-significant set bits before seeing an unset bit.
-
#bitwise_leading_zeros ⇒ Expr
Evaluate the number most-significant unset bits before seeing a set bit.
-
#bitwise_or ⇒ Expr
Perform an aggregation of bitwise ORs.
-
#bitwise_trailing_ones ⇒ Expr
Evaluate the number least-significant set bits before seeing an unset bit.
-
#bitwise_trailing_zeros ⇒ Expr
Evaluate the number least-significant unset bits before seeing a set bit.
-
#bitwise_xor ⇒ Expr
Perform an aggregation of bitwise XORs.
-
#bottom_k(k: 5) ⇒ Expr
Return the
k
smallest elements. -
#bottom_k_by(by, k: 5, reverse: false) ⇒ Expr
Return the elements corresponding to the
k
smallest elements of theby
column(s). -
#cast(dtype, strict: true) ⇒ Expr
Cast between data types.
-
#cat ⇒ CatExpr
Create an object namespace of all categorical related methods.
-
#cbrt ⇒ Expr
Compute the cube root of the elements.
-
#ceil ⇒ Expr
Rounds up to the nearest integer value.
-
#clip(lower_bound = nil, upper_bound = nil) ⇒ Expr
Set values outside the given boundaries to the boundary value.
-
#clip_max(upper_bound) ⇒ Expr
Clip (limit) the values in an array to a
max
boundary. -
#clip_min(lower_bound) ⇒ Expr
Clip (limit) the values in an array to a
min
boundary. -
#cos ⇒ Expr
Compute the element-wise value for the cosine.
-
#cosh ⇒ Expr
Compute the element-wise value for the hyperbolic cosine.
-
#cot ⇒ Expr
Compute the element-wise value for the cotangent.
-
#count ⇒ Expr
Count the number of values in this expression.
-
#cum_count(reverse: false) ⇒ Expr
(also: #cumcount)
Get an array with the cumulative count computed at every element.
-
#cum_max(reverse: false) ⇒ Expr
(also: #cummax)
Get an array with the cumulative max computed at every element.
-
#cum_min(reverse: false) ⇒ Expr
(also: #cummin)
Get an array with the cumulative min computed at every element.
-
#cum_prod(reverse: false) ⇒ Expr
(also: #cumprod)
Get an array with the cumulative product computed at every element.
-
#cum_sum(reverse: false) ⇒ Expr
(also: #cumsum)
Get an array with the cumulative sum computed at every element.
-
#cumulative_eval(expr, min_periods: 1) ⇒ Expr
Run an expression over a sliding window that increases
1
slot every iteration. -
#cut(breaks, labels: nil, left_closed: false, include_breaks: false) ⇒ Expr
Bin continuous values into discrete categories.
-
#degrees ⇒ Expr
Convert from radians to degrees.
-
#diff(n: 1, null_behavior: "ignore") ⇒ Expr
Calculate the n-th discrete difference.
-
#dot(other) ⇒ Expr
Compute the dot/inner product between two Expressions.
-
#drop_nans ⇒ Expr
Drop floating point NaN values.
-
#drop_nulls ⇒ Expr
Drop null values.
-
#dt ⇒ DateTimeExpr
Create an object namespace of all datetime related methods.
-
#entropy(base: 2, normalize: true) ⇒ Expr
Computes the entropy.
-
#eq(other) ⇒ Expr
Method equivalent of equality operator
expr == other
. -
#eq_missing(other) ⇒ Expr
Method equivalent of equality operator
expr == other
wherenil == nil
. -
#ewm_mean(com: nil, span: nil, half_life: nil, alpha: nil, adjust: true, min_periods: 1, ignore_nulls: true) ⇒ Expr
Exponentially-weighted moving average.
-
#ewm_mean_by(by, half_life:) ⇒ Expr
Compute time-based exponentially weighted moving average.
-
#ewm_std(com: nil, span: nil, half_life: nil, alpha: nil, adjust: true, bias: false, min_periods: 1, ignore_nulls: true) ⇒ Expr
Exponentially-weighted moving standard deviation.
-
#ewm_var(com: nil, span: nil, half_life: nil, alpha: nil, adjust: true, bias: false, min_periods: 1, ignore_nulls: true) ⇒ Expr
Exponentially-weighted moving variance.
-
#exclude(columns, *more_columns) ⇒ Expr
Exclude certain columns from a wildcard/regex selection.
-
#exp ⇒ Expr
Compute the exponential, element-wise.
-
#explode ⇒ Expr
Explode a list or utf8 Series.
-
#extend_constant(value, n) ⇒ Expr
Extend the Series with given number of values.
-
#fill_nan(fill_value) ⇒ Expr
Fill floating point NaN value with a fill value.
-
#fill_null(value = nil, strategy: nil, limit: nil) ⇒ Expr
Fill null values using the specified value or strategy.
-
#filter(predicate) ⇒ Expr
Filter a single column.
-
#first ⇒ Expr
Get the first value.
-
#flatten ⇒ Expr
Explode a list or utf8 Series.
-
#floor ⇒ Expr
Rounds down to the nearest integer value.
-
#floordiv(other) ⇒ Expr
Method equivalent of integer division operator
expr // other
. -
#forward_fill(limit: nil) ⇒ Expr
Fill missing values with the latest seen values.
-
#gather(indices) ⇒ Expr
(also: #take)
Take values by index.
-
#gather_every(n, offset = 0) ⇒ Expr
(also: #take_every)
Take every nth value in the Series and return as a new Series.
-
#ge(other) ⇒ Expr
Method equivalent of "greater than or equal" operator
expr >= other
. -
#get(index) ⇒ Expr
Return a single value by index.
-
#gt(other) ⇒ Expr
Method equivalent of "greater than" operator
expr > other
. -
#has_nulls ⇒ Expr
Check whether the expression contains one or more null values.
-
#head(n = 10) ⇒ Expr
Get the first
n
rows. -
#hist(bins: nil, bin_count: nil, include_category: false, include_breakpoint: false) ⇒ Expr
Bin values into buckets and count their occurrences.
-
#implode ⇒ Expr
Aggregate to list.
-
#index_of(element) ⇒ Expr
Get the index of the first occurrence of a value, or
None
if it's not found. -
#interpolate(method: "linear") ⇒ Expr
Fill nulls with linear interpolation over missing values.
-
#interpolate_by(by) ⇒ Expr
Fill null values using interpolation based on another column.
-
#is_between(lower_bound, upper_bound, closed: "both") ⇒ Expr
Check if this expression is between start and end.
-
#is_close(other, abs_tol: 0.0, rel_tol: 1e-09, nans_equal: false) ⇒ Expr
Check if this expression is close, i.e.
-
#is_duplicated ⇒ Expr
Get mask of duplicated values.
-
#is_finite ⇒ Expr
Returns a boolean Series indicating which values are finite.
-
#is_first_distinct ⇒ Expr
(also: #is_first)
Get a mask of the first unique value.
-
#is_in(other, nulls_equal: false) ⇒ Expr
(also: #in?)
Check if elements of this expression are present in the other Series.
-
#is_infinite ⇒ Expr
Returns a boolean Series indicating which values are infinite.
-
#is_last_distinct ⇒ Expr
Return a boolean mask indicating the last occurrence of each distinct value.
-
#is_nan ⇒ Expr
Returns a boolean Series indicating which values are NaN.
-
#is_not ⇒ Expr
(also: #not_)
Negate a boolean expression.
-
#is_not_nan ⇒ Expr
Returns a boolean Series indicating which values are not NaN.
-
#is_not_null ⇒ Expr
Returns a boolean Series indicating which values are not null.
-
#is_null ⇒ Expr
Returns a boolean Series indicating which values are null.
-
#is_unique ⇒ Expr
Get mask of unique values.
-
#keep_name ⇒ Expr
Keep the original root name of the expression.
-
#kurtosis(fisher: true, bias: true) ⇒ Expr
Compute the kurtosis (Fisher or Pearson) of a dataset.
-
#last ⇒ Expr
Get the last value.
-
#le(other) ⇒ Expr
Method equivalent of "less than or equal" operator
expr <= other
. -
#len ⇒ Expr
(also: #length)
Count the number of values in this expression.
-
#limit(n = 10) ⇒ Expr
Get the first
n
rows. -
#list ⇒ ListExpr
Create an object namespace of all list related methods.
-
#log(base = Math::E) ⇒ Expr
Compute the logarithm to a given base.
-
#log10 ⇒ Expr
Compute the base 10 logarithm of the input array, element-wise.
-
#log1p ⇒ Expr
Compute the natural logarithm of each element plus one.
-
#lower_bound ⇒ Expr
Calculate the lower bound.
-
#lt(other) ⇒ Expr
Method equivalent of "less than" operator
expr < other
. -
#map_alias(&f) ⇒ Expr
Rename the output of an expression by mapping a function over the root name.
-
#max ⇒ Expr
Get maximum value.
-
#mean ⇒ Expr
Get mean value.
-
#median ⇒ Expr
Get median value using linear interpolation.
-
#meta ⇒ MetaExpr
Create an object namespace of all meta related expression methods.
-
#min ⇒ Expr
Get minimum value.
-
#mod(other) ⇒ Expr
Method equivalent of modulus operator
expr % other
. -
#mode ⇒ Expr
Compute the most occurring value(s).
-
#mul(other) ⇒ Expr
Method equivalent of multiplication operator
expr * other
. -
#n_unique ⇒ Expr
Count unique values.
-
#name ⇒ NameExpr
Create an object namespace of all expressions that modify expression names.
-
#nan_max ⇒ Expr
Get maximum value, but propagate/poison encountered NaN values.
-
#nan_min ⇒ Expr
Get minimum value, but propagate/poison encountered NaN values.
-
#ne(other) ⇒ Expr
Method equivalent of inequality operator
expr != other
. -
#ne_missing(other) ⇒ Expr
Method equivalent of equality operator
expr != other
wherenil == nil
. -
#neg ⇒ Expr
Method equivalent of unary minus operator
-expr
. -
#null_count ⇒ Expr
Count null values.
-
#or_(*others) ⇒ Expr
Method equivalent of bitwise "or" operator
expr | other | ...
. -
#over(expr) ⇒ Expr
Apply window function over a subgroup.
-
#pct_change(n: 1) ⇒ Expr
Computes percentage change between values.
-
#peak_max ⇒ Expr
Get a boolean mask of the local maximum peaks.
-
#peak_min ⇒ Expr
Get a boolean mask of the local minimum peaks.
-
#pow(exponent) ⇒ Expr
Raise expression to the power of exponent.
-
#prefix(prefix) ⇒ Expr
Add a prefix to the root column name of the expression.
-
#product ⇒ Expr
Compute the product of an expression.
-
#qcut(quantiles, labels: nil, left_closed: false, allow_duplicates: false, include_breaks: false) ⇒ Expr
Bin continuous values into discrete categories based on their quantiles.
-
#quantile(quantile, interpolation: "nearest") ⇒ Expr
Get quantile value.
-
#radians ⇒ Expr
Convert from degrees to radians.
-
#rank(method: "average", reverse: false, seed: nil) ⇒ Expr
Assign ranks to data, dealing with ties appropriately.
-
#rechunk ⇒ Expr
Create a single chunk of memory for this Series.
-
#reinterpret(signed: false) ⇒ Expr
Reinterpret the underlying bits as a signed/unsigned integer.
-
#repeat_by(by) ⇒ Expr
Repeat the elements in this Series as specified in the given expression.
-
#replace(old, new = NO_DEFAULT, default: NO_DEFAULT, return_dtype: nil) ⇒ Expr
Replace values by different values.
-
#replace_strict(old, new = NO_DEFAULT, default: NO_DEFAULT, return_dtype: nil) ⇒ Expr
Replace all values by different values.
-
#reshape(dims) ⇒ Expr
Reshape this Expr to a flat Series or a Series of Lists.
-
#reverse ⇒ Expr
Reverse the selection.
-
#rle ⇒ Expr
Get the lengths of runs of identical values.
-
#rle_id ⇒ Expr
Map values to run IDs.
-
#rolling(index_column:, period:, offset: nil, closed: "right") ⇒ Expr
Create rolling groups based on a temporal or integer column.
-
#rolling_kurtosis(window_size, fisher: true, bias: true, min_samples: nil, center: false) ⇒ Expr
Compute a rolling kurtosis.
-
#rolling_max(window_size, weights: nil, min_periods: nil, center: false) ⇒ Expr
Apply a rolling max (moving max) over the values in this array.
-
#rolling_max_by(by, window_size, min_periods: 1, closed: "right", warn_if_unsorted: nil) ⇒ Expr
Apply a rolling max based on another column.
-
#rolling_mean(window_size, weights: nil, min_periods: nil, center: false) ⇒ Expr
Apply a rolling mean (moving mean) over the values in this array.
-
#rolling_mean_by(by, window_size, min_periods: 1, closed: "right", warn_if_unsorted: nil) ⇒ Expr
Apply a rolling mean based on another column.
-
#rolling_median(window_size, weights: nil, min_periods: nil, center: false) ⇒ Expr
Compute a rolling median.
-
#rolling_median_by(by, window_size, min_periods: 1, closed: "right", warn_if_unsorted: nil) ⇒ Expr
Compute a rolling median based on another column.
-
#rolling_min(window_size, weights: nil, min_periods: nil, center: false) ⇒ Expr
Apply a rolling min (moving min) over the values in this array.
-
#rolling_min_by(by, window_size, min_periods: 1, closed: "right", warn_if_unsorted: nil) ⇒ Expr
Apply a rolling min based on another column.
-
#rolling_quantile(quantile, interpolation: "nearest", window_size: 2, weights: nil, min_periods: nil, center: false) ⇒ Expr
Compute a rolling quantile.
-
#rolling_quantile_by(by, window_size, quantile:, interpolation: "nearest", min_periods: 1, closed: "right", warn_if_unsorted: nil) ⇒ Expr
Compute a rolling quantile based on another column.
-
#rolling_skew(window_size, bias: true, min_samples: nil, center: false) ⇒ Expr
Compute a rolling skew.
-
#rolling_std(window_size, weights: nil, min_periods: nil, center: false, ddof: 1) ⇒ Expr
Compute a rolling standard deviation.
-
#rolling_std_by(by, window_size, min_periods: 1, closed: "right", ddof: 1, warn_if_unsorted: nil) ⇒ Expr
Compute a rolling standard deviation based on another column.
-
#rolling_sum(window_size, weights: nil, min_periods: nil, center: false) ⇒ Expr
Apply a rolling sum (moving sum) over the values in this array.
-
#rolling_sum_by(by, window_size, min_periods: 1, closed: "right", warn_if_unsorted: nil) ⇒ Expr
Apply a rolling sum based on another column.
-
#rolling_var(window_size, weights: nil, min_periods: nil, center: false, ddof: 1) ⇒ Expr
Compute a rolling variance.
-
#rolling_var_by(by, window_size, min_periods: 1, closed: "right", ddof: 1, warn_if_unsorted: nil) ⇒ Expr
Compute a rolling variance based on another column.
-
#round(decimals = 0, mode: "half_to_even") ⇒ Expr
Round underlying floating point data by
decimals
digits. -
#round_sig_figs(digits) ⇒ Expr
Round to a number of significant figures.
-
#sample(frac: nil, with_replacement: true, shuffle: false, seed: nil, n: nil) ⇒ Expr
Sample from this expression.
-
#search_sorted(element, side: "any", descending: false) ⇒ Expr
Find indices where elements should be inserted to maintain order.
-
#set_sorted(descending: false) ⇒ Expr
Flags the expression as 'sorted'.
-
#shift(n = 1, fill_value: nil) ⇒ Expr
Shift the values by a given period.
-
#shift_and_fill(periods, fill_value) ⇒ Expr
Shift the values by a given period and fill the resulting null values.
-
#shrink_dtype ⇒ Expr
Shrink numeric columns to the minimal required datatype.
-
#shuffle(seed: nil) ⇒ Expr
Shuffle the contents of this expr.
-
#sign ⇒ Expr
Compute the element-wise indication of the sign.
-
#sin ⇒ Expr
Compute the element-wise value for the sine.
-
#sinh ⇒ Expr
Compute the element-wise value for the hyperbolic sine.
-
#skew(bias: true) ⇒ Expr
Compute the sample skewness of a data set.
-
#slice(offset, length = nil) ⇒ Expr
Get a slice of this expression.
-
#sort(reverse: false, nulls_last: false) ⇒ Expr
Sort this column.
-
#sort_by(by, *more_by, reverse: false, nulls_last: false, multithreaded: true, maintain_order: false) ⇒ Expr
Sort this column by the ordering of another column, or multiple other columns.
-
#sqrt ⇒ Expr
Compute the square root of the elements.
-
#std(ddof: 1) ⇒ Expr
Get standard deviation.
-
#str ⇒ StringExpr
Create an object namespace of all string related methods.
-
#struct ⇒ StructExpr
Create an object namespace of all struct related methods.
-
#sub(other) ⇒ Expr
Method equivalent of subtraction operator
expr - other
. -
#suffix(suffix) ⇒ Expr
Add a suffix to the root column name of the expression.
-
#sum ⇒ Expr
Get sum value.
-
#tail(n = 10) ⇒ Expr
Get the last
n
rows. -
#tan ⇒ Expr
Compute the element-wise value for the tangent.
-
#tanh ⇒ Expr
Compute the element-wise value for the hyperbolic tangent.
-
#to_physical ⇒ Expr
Cast to physical representation of the logical dtype.
-
#to_s ⇒ String
(also: #inspect)
Returns a string representing the Expr.
-
#top_k(k: 5) ⇒ Expr
Return the
k
largest elements. -
#top_k_by(by, k: 5, reverse: false) ⇒ Expr
Return the elements corresponding to the
k
largest elements of theby
column(s). -
#truediv(other) ⇒ Expr
Method equivalent of float division operator
expr / other
. -
#unique(maintain_order: false) ⇒ Expr
Get unique values of this expression.
-
#unique_counts ⇒ Expr
Return a count of the unique values in the order of appearance.
-
#upper_bound ⇒ Expr
Calculate the upper bound.
-
#value_counts(sort: false, parallel: false, name: nil, normalize: false) ⇒ Expr
Count all unique values and create a struct mapping value to count.
-
#var(ddof: 1) ⇒ Expr
Get variance.
-
#where(predicate) ⇒ Expr
Filter a single column.
-
#xor(other) ⇒ Expr
Method equivalent of bitwise exclusive-or operator
expr ^ other
. -
#|(other) ⇒ Expr
Bitwise OR.
Instance Method Details
#! ⇒ Expr Also known as: ~
Performs boolean not.
137 138 139 |
# File 'lib/polars/expr.rb', line 137 def ! is_not end |
#!=(other) ⇒ Expr
Not equal.
116 117 118 |
# File 'lib/polars/expr.rb', line 116 def !=(other) wrap_expr(_rbexpr.neq(_to_expr(other)._rbexpr)) end |
#%(other) ⇒ Expr
Returns the modulo.
80 81 82 |
# File 'lib/polars/expr.rb', line 80 def %(other) wrap_expr(_rbexpr % _to_rbexpr(other)) end |
#&(other) ⇒ Expr
Bitwise AND.
36 37 38 39 |
# File 'lib/polars/expr.rb', line 36 def &(other) other = Utils.parse_into_expression(other) wrap_expr(_rbexpr.and_(other)) end |
#*(other) ⇒ Expr
Performs multiplication.
66 67 68 |
# File 'lib/polars/expr.rb', line 66 def *(other) wrap_expr(_rbexpr * _to_rbexpr(other)) end |
#**(power) ⇒ Expr
Raises to the power of exponent.
87 88 89 90 |
# File 'lib/polars/expr.rb', line 87 def **(power) exponent = Utils.parse_into_expression(power) wrap_expr(_rbexpr.pow(exponent)) end |
#+(other) ⇒ Expr
Performs addition.
52 53 54 |
# File 'lib/polars/expr.rb', line 52 def +(other) wrap_expr(_rbexpr + _to_rbexpr(other)) end |
#-(other) ⇒ Expr
Performs subtraction.
59 60 61 |
# File 'lib/polars/expr.rb', line 59 def -(other) wrap_expr(_rbexpr - _to_rbexpr(other)) end |
#-@ ⇒ Expr
Performs negation.
145 146 147 |
# File 'lib/polars/expr.rb', line 145 def -@ wrap_expr(_rbexpr.neg) end |
#/(other) ⇒ Expr
Performs division.
73 74 75 |
# File 'lib/polars/expr.rb', line 73 def /(other) wrap_expr(_rbexpr / _to_rbexpr(other)) end |
#<(other) ⇒ Expr
Less than.
123 124 125 |
# File 'lib/polars/expr.rb', line 123 def <(other) wrap_expr(_rbexpr.lt(_to_expr(other)._rbexpr)) end |
#<=(other) ⇒ Expr
Less than or equal.
102 103 104 |
# File 'lib/polars/expr.rb', line 102 def <=(other) wrap_expr(_rbexpr.lt_eq(_to_expr(other)._rbexpr)) end |
#==(other) ⇒ Expr
Equal.
109 110 111 |
# File 'lib/polars/expr.rb', line 109 def ==(other) wrap_expr(_rbexpr.eq(_to_expr(other)._rbexpr)) end |
#>(other) ⇒ Expr
Greater than.
130 131 132 |
# File 'lib/polars/expr.rb', line 130 def >(other) wrap_expr(_rbexpr.gt(_to_expr(other)._rbexpr)) end |
#>=(other) ⇒ Expr
Greater than or equal.
95 96 97 |
# File 'lib/polars/expr.rb', line 95 def >=(other) wrap_expr(_rbexpr.gt_eq(_to_expr(other)._rbexpr)) end |
#^(other) ⇒ Expr
Bitwise XOR.
28 29 30 31 |
# File 'lib/polars/expr.rb', line 28 def ^(other) other = Utils.parse_into_expression(other) wrap_expr(_rbexpr.xor_(other)) end |
#_hash(seed = 0, seed_1 = nil, seed_2 = nil, seed_3 = nil) ⇒ Expr
Hash the elements in the selection.
The hash value is of type :u64
.
4484 4485 4486 4487 4488 4489 4490 |
# File 'lib/polars/expr.rb', line 4484 def _hash(seed = 0, seed_1 = nil, seed_2 = nil, seed_3 = nil) k0 = seed k1 = seed_1.nil? ? seed : seed_1 k2 = seed_2.nil? ? seed : seed_2 k3 = seed_3.nil? ? seed : seed_3 wrap_expr(_rbexpr._hash(k0, k1, k2, k3)) end |
#abs ⇒ Expr
Compute absolute values.
6421 6422 6423 |
# File 'lib/polars/expr.rb', line 6421 def abs wrap_expr(_rbexpr.abs) end |
#add(other) ⇒ Expr
Method equivalent of addition operator expr + other
.
4042 4043 4044 |
# File 'lib/polars/expr.rb', line 4042 def add(other) self + other end |
#agg_groups ⇒ Expr
Get the group indexes of the group by operation.
Should be used in aggregation context only.
776 777 778 |
# File 'lib/polars/expr.rb', line 776 def agg_groups wrap_expr(_rbexpr.agg_groups) end |
#alias(name) ⇒ Expr
Rename the output of an expression.
376 377 378 |
# File 'lib/polars/expr.rb', line 376 def alias(name) wrap_expr(_rbexpr._alias(name)) end |
#all(drop_nulls: true) ⇒ Boolean
Check if all boolean values in a Boolean column are true
.
This method is an expression - not to be confused with
Polars.all
which is a function to select all columns.
227 228 229 |
# File 'lib/polars/expr.rb', line 227 def all(drop_nulls: true) wrap_expr(_rbexpr.all(drop_nulls)) end |
#and_(*others) ⇒ Expr
Method equivalent of bitwise "and" operator expr & other & ...
.
3679 3680 3681 |
# File 'lib/polars/expr.rb', line 3679 def and_(*others) ([self] + others).reduce(:&) end |
#any(drop_nulls: true) ⇒ Boolean
Check if any boolean value in a Boolean column is true
.
202 203 204 |
# File 'lib/polars/expr.rb', line 202 def any(drop_nulls: true) wrap_expr(_rbexpr.any(drop_nulls)) end |
#append(other, upcast: true) ⇒ Expr
Append expressions.
This is done by adding the chunks of other
to this Series
.
888 889 890 891 |
# File 'lib/polars/expr.rb', line 888 def append(other, upcast: true) other = Utils.parse_into_expression(other) wrap_expr(_rbexpr.append(other, upcast)) end |
#approx_n_unique ⇒ Expr Also known as: approx_unique
Approx count unique values.
This is done using the HyperLogLog++ algorithm for cardinality estimation.
2512 2513 2514 |
# File 'lib/polars/expr.rb', line 2512 def approx_n_unique wrap_expr(_rbexpr.approx_n_unique) end |
#arccos ⇒ Expr
Compute the element-wise value for the inverse cosine.
6937 6938 6939 |
# File 'lib/polars/expr.rb', line 6937 def arccos wrap_expr(_rbexpr.arccos) end |
#arccosh ⇒ Expr
Compute the element-wise value for the inverse hyperbolic cosine.
7057 7058 7059 |
# File 'lib/polars/expr.rb', line 7057 def arccosh wrap_expr(_rbexpr.arccosh) end |
#arcsin ⇒ Expr
Compute the element-wise value for the inverse sine.
6917 6918 6919 |
# File 'lib/polars/expr.rb', line 6917 def arcsin wrap_expr(_rbexpr.arcsin) end |
#arcsinh ⇒ Expr
Compute the element-wise value for the inverse hyperbolic sine.
7037 7038 7039 |
# File 'lib/polars/expr.rb', line 7037 def arcsinh wrap_expr(_rbexpr.arcsinh) end |
#arctan ⇒ Expr
Compute the element-wise value for the inverse tangent.
6957 6958 6959 |
# File 'lib/polars/expr.rb', line 6957 def arctan wrap_expr(_rbexpr.arctan) end |
#arctanh ⇒ Expr
Compute the element-wise value for the inverse hyperbolic tangent.
7077 7078 7079 |
# File 'lib/polars/expr.rb', line 7077 def arctanh wrap_expr(_rbexpr.arctanh) end |
#arg_max ⇒ Expr
Get the index of the maximal value.
1762 1763 1764 |
# File 'lib/polars/expr.rb', line 1762 def arg_max wrap_expr(_rbexpr.arg_max) end |
#arg_min ⇒ Expr
Get the index of the minimal value.
1786 1787 1788 |
# File 'lib/polars/expr.rb', line 1786 def arg_min wrap_expr(_rbexpr.arg_min) end |
#arg_sort(reverse: false, nulls_last: false) ⇒ Expr
Get the index values that would sort this column.
1738 1739 1740 |
# File 'lib/polars/expr.rb', line 1738 def arg_sort(reverse: false, nulls_last: false) wrap_expr(_rbexpr.arg_sort(reverse, nulls_last)) end |
#arg_true ⇒ Expr
Modifies number of rows returned, so will fail in combination with other
expressions. Use as only expression in select
/ with_columns
.
Return indices where expression evaluates true
.
253 254 255 |
# File 'lib/polars/expr.rb', line 253 def arg_true wrap_expr(Plr.arg_where(_rbexpr)) end |
#arg_unique ⇒ Expr
Get index of first unique value.
2604 2605 2606 |
# File 'lib/polars/expr.rb', line 2604 def arg_unique wrap_expr(_rbexpr.arg_unique) end |
#argsort(reverse: false, nulls_last: false) ⇒ expr
Get the index values that would sort this column.
Alias for #arg_sort.
6454 6455 6456 |
# File 'lib/polars/expr.rb', line 6454 def argsort(reverse: false, nulls_last: false) arg_sort(reverse: reverse, nulls_last: nulls_last) end |
#arr ⇒ ArrayExpr
Create an object namespace of all array related methods.
8313 8314 8315 |
# File 'lib/polars/expr.rb', line 8313 def arr ArrayExpr.new(self) end |
#backward_fill(limit: nil) ⇒ Expr
Fill missing values with the next to be seen values.
2224 2225 2226 |
# File 'lib/polars/expr.rb', line 2224 def backward_fill(limit: nil) fill_null(strategy: "backward", limit: limit) end |
#bin ⇒ BinaryExpr
Create an object namespace of all binary related methods.
8320 8321 8322 |
# File 'lib/polars/expr.rb', line 8320 def bin BinaryExpr.new(self) end |
#bitwise_and ⇒ Expr
Perform an aggregation of bitwise ANDs.
8227 8228 8229 |
# File 'lib/polars/expr.rb', line 8227 def bitwise_and wrap_expr(_rbexpr.bitwise_and) end |
#bitwise_count_ones ⇒ Expr
Evaluate the number of set bits.
8156 8157 8158 |
# File 'lib/polars/expr.rb', line 8156 def bitwise_count_ones wrap_expr(_rbexpr.bitwise_count_ones) end |
#bitwise_count_zeros ⇒ Expr
Evaluate the number of unset bits.
8163 8164 8165 |
# File 'lib/polars/expr.rb', line 8163 def bitwise_count_zeros wrap_expr(_rbexpr.bitwise_count_zeros) end |
#bitwise_leading_ones ⇒ Expr
Evaluate the number most-significant set bits before seeing an unset bit.
8170 8171 8172 |
# File 'lib/polars/expr.rb', line 8170 def bitwise_leading_ones wrap_expr(_rbexpr.bitwise_leading_ones) end |
#bitwise_leading_zeros ⇒ Expr
Evaluate the number most-significant unset bits before seeing a set bit.
8177 8178 8179 |
# File 'lib/polars/expr.rb', line 8177 def bitwise_leading_zeros wrap_expr(_rbexpr.bitwise_leading_zeros) end |
#bitwise_or ⇒ Expr
Perform an aggregation of bitwise ORs.
8263 8264 8265 |
# File 'lib/polars/expr.rb', line 8263 def bitwise_or wrap_expr(_rbexpr.bitwise_or) end |
#bitwise_trailing_ones ⇒ Expr
Evaluate the number least-significant set bits before seeing an unset bit.
8184 8185 8186 |
# File 'lib/polars/expr.rb', line 8184 def bitwise_trailing_ones wrap_expr(_rbexpr.bitwise_trailing_ones) end |
#bitwise_trailing_zeros ⇒ Expr
Evaluate the number least-significant unset bits before seeing a set bit.
8191 8192 8193 |
# File 'lib/polars/expr.rb', line 8191 def bitwise_trailing_zeros wrap_expr(_rbexpr.bitwise_trailing_zeros) end |
#bitwise_xor ⇒ Expr
Perform an aggregation of bitwise XORs.
8299 8300 8301 |
# File 'lib/polars/expr.rb', line 8299 def bitwise_xor wrap_expr(_rbexpr.bitwise_xor) end |
#bottom_k(k: 5) ⇒ Expr
Return the k
smallest elements.
If 'reverse: true` the smallest elements will be given.
1600 1601 1602 1603 |
# File 'lib/polars/expr.rb', line 1600 def bottom_k(k: 5) k = Utils.parse_into_expression(k) wrap_expr(_rbexpr.bottom_k(k)) end |
#bottom_k_by(by, k: 5, reverse: false) ⇒ Expr
Return the elements corresponding to the k
smallest elements of the by
column(s).
Non-null elements are always preferred over null elements, regardless of
the value of reverse
. The output is not guaranteed to be in any
particular order, call :func:sort
after this function if you wish the
output to be sorted.
1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 |
# File 'lib/polars/expr.rb', line 1700 def bottom_k_by( by, k: 5, reverse: false ) k = Utils.parse_into_expression(k) by = Utils.parse_into_list_of_expressions(by) reverse = Utils.extend_bool(reverse, by.length, "reverse", "by") wrap_expr(_rbexpr.bottom_k_by(by, k, reverse)) end |
#cast(dtype, strict: true) ⇒ Expr
Cast between data types.
1341 1342 1343 1344 |
# File 'lib/polars/expr.rb', line 1341 def cast(dtype, strict: true) dtype = Utils.rb_type_to_dtype(dtype) wrap_expr(_rbexpr.cast(dtype, strict)) end |
#cat ⇒ CatExpr
Create an object namespace of all categorical related methods.
8327 8328 8329 |
# File 'lib/polars/expr.rb', line 8327 def cat CatExpr.new(self) end |
#cbrt ⇒ Expr
Compute the cube root of the elements.
297 298 299 |
# File 'lib/polars/expr.rb', line 297 def cbrt wrap_expr(_rbexpr.cbrt) end |
#ceil ⇒ Expr
Rounds up to the nearest integer value.
Only works on floating point Series.
1188 1189 1190 |
# File 'lib/polars/expr.rb', line 1188 def ceil wrap_expr(_rbexpr.ceil) end |
#clip(lower_bound = nil, upper_bound = nil) ⇒ Expr
Set values outside the given boundaries to the boundary value.
Only works for numeric and temporal columns. If you want to clip other data
types, consider writing a when-then-otherwise
expression.
6679 6680 6681 6682 6683 6684 6685 6686 6687 |
# File 'lib/polars/expr.rb', line 6679 def clip(lower_bound = nil, upper_bound = nil) if !lower_bound.nil? lower_bound = Utils.parse_into_expression(lower_bound) end if !upper_bound.nil? upper_bound = Utils.parse_into_expression(upper_bound) end wrap_expr(_rbexpr.clip(lower_bound, upper_bound)) end |
#clip_max(upper_bound) ⇒ Expr
Clip (limit) the values in an array to a max
boundary.
Only works for numerical types.
If you want to clip other dtypes, consider writing a "when, then, otherwise"
expression. See when
for more information.
6747 6748 6749 |
# File 'lib/polars/expr.rb', line 6747 def clip_max(upper_bound) clip(nil, upper_bound) end |
#clip_min(lower_bound) ⇒ Expr
Clip (limit) the values in an array to a min
boundary.
Only works for numerical types.
If you want to clip other dtypes, consider writing a "when, then, otherwise"
expression. See when
for more information.
6716 6717 6718 |
# File 'lib/polars/expr.rb', line 6716 def clip_min(lower_bound) clip(lower_bound, nil) end |
#cos ⇒ Expr
Compute the element-wise value for the cosine.
6857 6858 6859 |
# File 'lib/polars/expr.rb', line 6857 def cos wrap_expr(_rbexpr.cos) end |
#cosh ⇒ Expr
Compute the element-wise value for the hyperbolic cosine.
6997 6998 6999 |
# File 'lib/polars/expr.rb', line 6997 def cosh wrap_expr(_rbexpr.cosh) end |
#cot ⇒ Expr
Compute the element-wise value for the cotangent.
6897 6898 6899 |
# File 'lib/polars/expr.rb', line 6897 def cot wrap_expr(_rbexpr.cot) end |
#count ⇒ Expr
Count the number of values in this expression.
796 797 798 |
# File 'lib/polars/expr.rb', line 796 def count wrap_expr(_rbexpr.count) end |
#cum_count(reverse: false) ⇒ Expr Also known as: cumcount
Get an array with the cumulative count computed at every element.
Counting from 0 to len
1137 1138 1139 |
# File 'lib/polars/expr.rb', line 1137 def cum_count(reverse: false) wrap_expr(_rbexpr.cum_count(reverse)) end |
#cum_max(reverse: false) ⇒ Expr Also known as: cummax
Get an array with the cumulative max computed at every element.
1103 1104 1105 |
# File 'lib/polars/expr.rb', line 1103 def cum_max(reverse: false) wrap_expr(_rbexpr.cum_max(reverse)) end |
#cum_min(reverse: false) ⇒ Expr Also known as: cummin
Get an array with the cumulative min computed at every element.
1071 1072 1073 |
# File 'lib/polars/expr.rb', line 1071 def cum_min(reverse: false) wrap_expr(_rbexpr.cum_min(reverse)) end |
#cum_prod(reverse: false) ⇒ Expr Also known as: cumprod
Dtypes in :i8
, :u8
, :i16
, and :u16
are cast to
:i64
before summing to prevent overflow issues.
Get an array with the cumulative product computed at every element.
1039 1040 1041 |
# File 'lib/polars/expr.rb', line 1039 def cum_prod(reverse: false) wrap_expr(_rbexpr.cum_prod(reverse)) end |
#cum_sum(reverse: false) ⇒ Expr Also known as: cumsum
Dtypes in :i8
, :u8
, :i16
, and :u16
are cast to
:i64
before summing to prevent overflow issues.
Get an array with the cumulative sum computed at every element.
1003 1004 1005 |
# File 'lib/polars/expr.rb', line 1003 def cum_sum(reverse: false) wrap_expr(_rbexpr.cum_sum(reverse)) end |
#cumulative_eval(expr, min_periods: 1) ⇒ Expr
This functionality is experimental and may change without it being considered a breaking change.
This can be really slow as it can have O(n^2)
complexity. Don't use this
for operations that visit all elements.
Run an expression over a sliding window that increases 1
slot every iteration.
7680 7681 7682 7683 7684 |
# File 'lib/polars/expr.rb', line 7680 def cumulative_eval(expr, min_periods: 1) wrap_expr( _rbexpr.cumulative_eval(expr._rbexpr, min_periods) ) end |
#cut(breaks, labels: nil, left_closed: false, include_breaks: false) ⇒ Expr
Bin continuous values into discrete categories.
3114 3115 3116 |
# File 'lib/polars/expr.rb', line 3114 def cut(breaks, labels: nil, left_closed: false, include_breaks: false) wrap_expr(_rbexpr.cut(breaks, labels, left_closed, include_breaks)) end |
#degrees ⇒ Expr
Convert from radians to degrees.
7105 7106 7107 |
# File 'lib/polars/expr.rb', line 7105 def degrees wrap_expr(_rbexpr.degrees) end |
#diff(n: 1, null_behavior: "ignore") ⇒ Expr
Calculate the n-th discrete difference.
6549 6550 6551 6552 |
# File 'lib/polars/expr.rb', line 6549 def diff(n: 1, null_behavior: "ignore") n = Utils.parse_into_expression(n) wrap_expr(_rbexpr.diff(n, null_behavior)) end |
#dot(other) ⇒ Expr
Compute the dot/inner product between two Expressions.
1274 1275 1276 1277 |
# File 'lib/polars/expr.rb', line 1274 def dot(other) other = Utils.parse_into_expression(other, str_as_lit: false) wrap_expr(_rbexpr.dot(other)) end |
#drop_nans ⇒ Expr
Drop floating point NaN values.
968 969 970 |
# File 'lib/polars/expr.rb', line 968 def drop_nans wrap_expr(_rbexpr.drop_nans) end |
#drop_nulls ⇒ Expr
Drop null values.
941 942 943 |
# File 'lib/polars/expr.rb', line 941 def drop_nulls wrap_expr(_rbexpr.drop_nulls) end |
#dt ⇒ DateTimeExpr
Create an object namespace of all datetime related methods.
8334 8335 8336 |
# File 'lib/polars/expr.rb', line 8334 def dt DateTimeExpr.new(self) end |
#entropy(base: 2, normalize: true) ⇒ Expr
Computes the entropy.
Uses the formula -sum(pk * log(pk)
where pk
are discrete probabilities.
7636 7637 7638 |
# File 'lib/polars/expr.rb', line 7636 def entropy(base: 2, normalize: true) wrap_expr(_rbexpr.entropy(base, normalize)) end |
#eq(other) ⇒ Expr
Method equivalent of equality operator expr == other
.
3752 3753 3754 |
# File 'lib/polars/expr.rb', line 3752 def eq(other) self == other end |
#eq_missing(other) ⇒ Expr
Method equivalent of equality operator expr == other
where nil == nil
.
This differs from default eq
where null values are propagated.
3790 3791 3792 3793 |
# File 'lib/polars/expr.rb', line 3790 def eq_missing(other) other = Utils.parse_into_expression(other, str_as_lit: true) wrap_expr(_rbexpr.eq_missing(other)) end |
#ewm_mean(com: nil, span: nil, half_life: nil, alpha: nil, adjust: true, min_periods: 1, ignore_nulls: true) ⇒ Expr
Exponentially-weighted moving average.
7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 |
# File 'lib/polars/expr.rb', line 7285 def ewm_mean( com: nil, span: nil, half_life: nil, alpha: nil, adjust: true, min_periods: 1, ignore_nulls: true ) alpha = _prepare_alpha(com, span, half_life, alpha) wrap_expr(_rbexpr.ewm_mean(alpha, adjust, min_periods, ignore_nulls)) end |
#ewm_mean_by(by, half_life:) ⇒ Expr
Compute time-based exponentially weighted moving average.
7358 7359 7360 7361 7362 7363 7364 7365 |
# File 'lib/polars/expr.rb', line 7358 def ewm_mean_by( by, half_life: ) by = Utils.parse_into_expression(by) half_life = Utils.parse_as_duration_string(half_life) wrap_expr(_rbexpr.ewm_mean_by(by, half_life)) end |
#ewm_std(com: nil, span: nil, half_life: nil, alpha: nil, adjust: true, bias: false, min_periods: 1, ignore_nulls: true) ⇒ Expr
Exponentially-weighted moving standard deviation.
7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 |
# File 'lib/polars/expr.rb', line 7385 def ewm_std( com: nil, span: nil, half_life: nil, alpha: nil, adjust: true, bias: false, min_periods: 1, ignore_nulls: true ) alpha = _prepare_alpha(com, span, half_life, alpha) wrap_expr(_rbexpr.ewm_std(alpha, adjust, bias, min_periods, ignore_nulls)) end |
#ewm_var(com: nil, span: nil, half_life: nil, alpha: nil, adjust: true, bias: false, min_periods: 1, ignore_nulls: true) ⇒ Expr
Exponentially-weighted moving variance.
7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 |
# File 'lib/polars/expr.rb', line 7417 def ewm_var( com: nil, span: nil, half_life: nil, alpha: nil, adjust: true, bias: false, min_periods: 1, ignore_nulls: true ) alpha = _prepare_alpha(com, span, half_life, alpha) wrap_expr(_rbexpr.ewm_var(alpha, adjust, bias, min_periods, ignore_nulls)) end |
#exclude(columns, *more_columns) ⇒ Expr
Exclude certain columns from a wildcard/regex selection.
You may also use regexes in the exclude list. They must start with ^
and end
with $
.
416 417 418 |
# File 'lib/polars/expr.rb', line 416 def exclude(columns, *more_columns) .as_selector.exclude(columns, *more_columns).as_expr end |
#exp ⇒ Expr
Compute the exponential, element-wise.
341 342 343 |
# File 'lib/polars/expr.rb', line 341 def exp wrap_expr(_rbexpr.exp) end |
#explode ⇒ Expr
Explode a list or utf8 Series.
This means that every item is expanded to a new row.
3537 3538 3539 |
# File 'lib/polars/expr.rb', line 3537 def explode wrap_expr(_rbexpr.explode) end |
#extend_constant(value, n) ⇒ Expr
Extend the Series with given number of values.
7457 7458 7459 7460 7461 |
# File 'lib/polars/expr.rb', line 7457 def extend_constant(value, n) value = Utils.parse_into_expression(value, str_as_lit: true) n = Utils.parse_into_expression(n) wrap_expr(_rbexpr.extend_constant(value, n)) end |
#fill_nan(fill_value) ⇒ Expr
Fill floating point NaN value with a fill value.
2163 2164 2165 2166 |
# File 'lib/polars/expr.rb', line 2163 def fill_nan(fill_value) fill_value = Utils.parse_into_expression(fill_value, str_as_lit: true) wrap_expr(_rbexpr.fill_nan(fill_value)) end |
#fill_null(value = nil, strategy: nil, limit: nil) ⇒ Expr
Fill null values using the specified value or strategy.
To interpolate over null values see interpolate.
2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 |
# File 'lib/polars/expr.rb', line 2123 def fill_null(value = nil, strategy: nil, limit: nil) if !value.nil? && !strategy.nil? raise ArgumentError, "cannot specify both 'value' and 'strategy'." elsif value.nil? && strategy.nil? raise ArgumentError, "must specify either a fill 'value' or 'strategy'" elsif ["forward", "backward"].include?(strategy) && !limit.nil? raise ArgumentError, "can only specify 'limit' when strategy is set to 'backward' or 'forward'" end if !value.nil? value = Utils.parse_into_expression(value, str_as_lit: true) wrap_expr(_rbexpr.fill_null(value)) else wrap_expr(_rbexpr.fill_null_with_strategy(strategy, limit)) end end |
#filter(predicate) ⇒ Expr
Filter a single column.
Mostly useful in an aggregation context. If you want to filter on a DataFrame
level, use LazyFrame#filter
.
3297 3298 3299 |
# File 'lib/polars/expr.rb', line 3297 def filter(predicate) wrap_expr(_rbexpr.filter(predicate._rbexpr)) end |
#first ⇒ Expr
Get the first value.
2652 2653 2654 |
# File 'lib/polars/expr.rb', line 2652 def first wrap_expr(_rbexpr.first) end |
#flatten ⇒ Expr
Explode a list or utf8 Series. This means that every item is expanded to a new row.
Alias for #explode.
3510 3511 3512 |
# File 'lib/polars/expr.rb', line 3510 def flatten wrap_expr(_rbexpr.explode) end |
#floor ⇒ Expr
Rounds down to the nearest integer value.
Only works on floating point Series.
1163 1164 1165 |
# File 'lib/polars/expr.rb', line 1163 def floor wrap_expr(_rbexpr.floor) end |
#floordiv(other) ⇒ Expr
Method equivalent of integer division operator expr // other
.
4072 4073 4074 |
# File 'lib/polars/expr.rb', line 4072 def floordiv(other) wrap_expr(_rbexpr.floordiv(_to_rbexpr(other))) end |
#forward_fill(limit: nil) ⇒ Expr
Fill missing values with the latest seen values.
2194 2195 2196 |
# File 'lib/polars/expr.rb', line 2194 def forward_fill(limit: nil) fill_null(strategy: "forward", limit: limit) end |
#gather(indices) ⇒ Expr Also known as: take
Take values by index.
1955 1956 1957 1958 1959 1960 1961 1962 |
# File 'lib/polars/expr.rb', line 1955 def gather(indices) if indices.is_a?(::Array) indices_lit = Polars.lit(Series.new("", indices, dtype: :u32))._rbexpr else indices_lit = Utils.parse_into_expression(indices, str_as_lit: false) end wrap_expr(_rbexpr.gather(indices_lit)) end |
#gather_every(n, offset = 0) ⇒ Expr Also known as: take_every
Take every nth value in the Series and return as a new Series.
3559 3560 3561 |
# File 'lib/polars/expr.rb', line 3559 def gather_every(n, offset = 0) wrap_expr(_rbexpr.gather_every(n, offset)) end |
#ge(other) ⇒ Expr
Method equivalent of "greater than or equal" operator expr >= other
.
3824 3825 3826 |
# File 'lib/polars/expr.rb', line 3824 def ge(other) self >= other end |
#get(index) ⇒ Expr
Return a single value by index.
1997 1998 1999 2000 |
# File 'lib/polars/expr.rb', line 1997 def get(index) index_lit = Utils.parse_into_expression(index) wrap_expr(_rbexpr.get(index_lit)) end |
#gt(other) ⇒ Expr
Method equivalent of "greater than" operator expr > other
.
3857 3858 3859 |
# File 'lib/polars/expr.rb', line 3857 def gt(other) self > other end |
#has_nulls ⇒ Expr
Check whether the expression contains one or more null values.
2564 2565 2566 |
# File 'lib/polars/expr.rb', line 2564 def has_nulls null_count > 0 end |
#head(n = 10) ⇒ Expr
Get the first n
rows.
3585 3586 3587 |
# File 'lib/polars/expr.rb', line 3585 def head(n = 10) wrap_expr(_rbexpr.head(n)) end |
#hist(bins: nil, bin_count: nil, include_category: false, include_breakpoint: false) ⇒ Expr
This functionality is considered unstable. It may be changed at any point without it being considered a breaking change.
Bin values into buckets and count their occurrences.
7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 |
# File 'lib/polars/expr.rb', line 7823 def hist( bins: nil, bin_count: nil, include_category: false, include_breakpoint: false ) if !bins.nil? if bins.is_a?(::Array) bins = Polars::Series.new(bins) end bins = Utils.parse_into_expression(bins) end wrap_expr( _rbexpr.hist(bins, bin_count, include_category, include_breakpoint) ) end |
#implode ⇒ Expr
Aggregate to list.
7736 7737 7738 |
# File 'lib/polars/expr.rb', line 7736 def implode wrap_expr(_rbexpr.implode) end |
#index_of(element) ⇒ Expr
Get the index of the first occurrence of a value, or None
if it's not found.
1815 1816 1817 1818 |
# File 'lib/polars/expr.rb', line 1815 def index_of(element) element = Utils.parse_into_expression(element, str_as_lit: true) wrap_expr(_rbexpr.index_of(element)) end |
#interpolate(method: "linear") ⇒ Expr
Fill nulls with linear interpolation over missing values.
Can also be used to regrid data to a new grid - see examples below.
4585 4586 4587 |
# File 'lib/polars/expr.rb', line 4585 def interpolate(method: "linear") wrap_expr(_rbexpr.interpolate(method)) end |
#interpolate_by(by) ⇒ Expr
Fill null values using interpolation based on another column.
4615 4616 4617 4618 |
# File 'lib/polars/expr.rb', line 4615 def interpolate_by(by) by = Utils.parse_into_expression(by) wrap_expr(_rbexpr.interpolate_by(by)) end |
#is_between(lower_bound, upper_bound, closed: "both") ⇒ Expr
Check if this expression is between start and end.
4404 4405 4406 4407 4408 4409 4410 4411 |
# File 'lib/polars/expr.rb', line 4404 def is_between(lower_bound, upper_bound, closed: "both") lower_bound = Utils.parse_into_expression(lower_bound) upper_bound = Utils.parse_into_expression(upper_bound) wrap_expr( _rbexpr.is_between(lower_bound, upper_bound, closed) ) end |
#is_close(other, abs_tol: 0.0, rel_tol: 1e-09, nans_equal: false) ⇒ Expr
Check if this expression is close, i.e. almost equal, to the other expression.
4440 4441 4442 4443 4444 4445 4446 4447 4448 |
# File 'lib/polars/expr.rb', line 4440 def is_close( other, abs_tol: 0.0, rel_tol: 1e-09, nans_equal: false ) other = Utils.parse_into_expression(other) wrap_expr(_rbexpr.is_close(other, abs_tol, rel_tol, nans_equal)) end |
#is_duplicated ⇒ Expr
Get mask of duplicated values.
2936 2937 2938 |
# File 'lib/polars/expr.rb', line 2936 def is_duplicated wrap_expr(_rbexpr.is_duplicated) end |
#is_finite ⇒ Expr
Returns a boolean Series indicating which values are finite.
649 650 651 |
# File 'lib/polars/expr.rb', line 649 def is_finite wrap_expr(_rbexpr.is_finite) end |
#is_first_distinct ⇒ Expr Also known as: is_first
Get a mask of the first unique value.
2889 2890 2891 |
# File 'lib/polars/expr.rb', line 2889 def is_first_distinct wrap_expr(_rbexpr.is_first_distinct) end |
#is_in(other, nulls_equal: false) ⇒ Expr Also known as: in?
Check if elements of this expression are present in the other Series.
4297 4298 4299 4300 |
# File 'lib/polars/expr.rb', line 4297 def is_in(other, nulls_equal: false) other = Utils.parse_into_expression(other) wrap_expr(_rbexpr.is_in(other, nulls_equal)) end |
#is_infinite ⇒ Expr
Returns a boolean Series indicating which values are infinite.
675 676 677 |
# File 'lib/polars/expr.rb', line 675 def is_infinite wrap_expr(_rbexpr.is_infinite) end |
#is_last_distinct ⇒ Expr
Return a boolean mask indicating the last occurrence of each distinct value.
2914 2915 2916 |
# File 'lib/polars/expr.rb', line 2914 def is_last_distinct wrap_expr(_rbexpr.is_last_distinct) end |
#is_nan ⇒ Expr
Floating point NaN
(Not A Number) should not be confused
with missing data represented as nil
.
Returns a boolean Series indicating which values are NaN.
708 709 710 |
# File 'lib/polars/expr.rb', line 708 def is_nan wrap_expr(_rbexpr.is_nan) end |
#is_not ⇒ Expr Also known as: not_
Negate a boolean expression.
564 565 566 |
# File 'lib/polars/expr.rb', line 564 def is_not wrap_expr(_rbexpr.not_) end |
#is_not_nan ⇒ Expr
Floating point NaN
(Not A Number) should not be confused
with missing data represented as nil
.
Returns a boolean Series indicating which values are not NaN.
741 742 743 |
# File 'lib/polars/expr.rb', line 741 def is_not_nan wrap_expr(_rbexpr.is_not_nan) end |
#is_not_null ⇒ Expr
Returns a boolean Series indicating which values are not null.
623 624 625 |
# File 'lib/polars/expr.rb', line 623 def is_not_null wrap_expr(_rbexpr.is_not_null) end |
#is_null ⇒ Expr
Returns a boolean Series indicating which values are null.
594 595 596 |
# File 'lib/polars/expr.rb', line 594 def is_null wrap_expr(_rbexpr.is_null) end |
#is_unique ⇒ Expr
Get mask of unique values.
2861 2862 2863 |
# File 'lib/polars/expr.rb', line 2861 def is_unique wrap_expr(_rbexpr.is_unique) end |
#keep_name ⇒ Expr
Keep the original root name of the expression.
442 443 444 |
# File 'lib/polars/expr.rb', line 442 def keep_name name.keep end |
#kurtosis(fisher: true, bias: true) ⇒ Expr
Compute the kurtosis (Fisher or Pearson) of a dataset.
Kurtosis is the fourth central moment divided by the square of the variance. If Fisher's definition is used, then 3.0 is subtracted from the result to give 0.0 for a normal distribution. If bias is False then the kurtosis is calculated using k statistics to eliminate bias coming from biased moment estimators
6648 6649 6650 |
# File 'lib/polars/expr.rb', line 6648 def kurtosis(fisher: true, bias: true) wrap_expr(_rbexpr.kurtosis(fisher, bias)) end |
#last ⇒ Expr
Get the last value.
2672 2673 2674 |
# File 'lib/polars/expr.rb', line 2672 def last wrap_expr(_rbexpr.last) end |
#le(other) ⇒ Expr
Method equivalent of "less than or equal" operator expr <= other
.
3890 3891 3892 |
# File 'lib/polars/expr.rb', line 3890 def le(other) self <= other end |
#len ⇒ Expr Also known as: length
Count the number of values in this expression.
816 817 818 |
# File 'lib/polars/expr.rb', line 816 def len wrap_expr(_rbexpr.len) end |
#limit(n = 10) ⇒ Expr
Get the first n
rows.
Alias for #head.
3637 3638 3639 |
# File 'lib/polars/expr.rb', line 3637 def limit(n = 10) head(n) end |
#list ⇒ ListExpr
Create an object namespace of all list related methods.
8306 8307 8308 |
# File 'lib/polars/expr.rb', line 8306 def list ListExpr.new(self) end |
#log(base = Math::E) ⇒ Expr
Compute the logarithm to a given base.
7573 7574 7575 |
# File 'lib/polars/expr.rb', line 7573 def log(base = Math::E) wrap_expr(_rbexpr.log(base)) end |
#log10 ⇒ Expr
Compute the base 10 logarithm of the input array, element-wise.
319 320 321 |
# File 'lib/polars/expr.rb', line 319 def log10 log(10) end |
#log1p ⇒ Expr
Compute the natural logarithm of each element plus one.
This computes log(1 + x)
but is more numerically stable for x
close to zero.
7597 7598 7599 |
# File 'lib/polars/expr.rb', line 7597 def log1p wrap_expr(_rbexpr.log1p) end |
#lower_bound ⇒ Expr
Calculate the lower bound.
Returns a unit Series with the lowest value possible for the dtype of this expression.
6770 6771 6772 |
# File 'lib/polars/expr.rb', line 6770 def lower_bound wrap_expr(_rbexpr.lower_bound) end |
#lt(other) ⇒ Expr
Method equivalent of "less than" operator expr < other
.
3923 3924 3925 |
# File 'lib/polars/expr.rb', line 3923 def lt(other) self < other end |
#map_alias(&f) ⇒ Expr
Rename the output of an expression by mapping a function over the root name.
524 525 526 |
# File 'lib/polars/expr.rb', line 524 def map_alias(&f) name.map(&f) end |
#max ⇒ Expr
Get maximum value.
2326 2327 2328 |
# File 'lib/polars/expr.rb', line 2326 def max wrap_expr(_rbexpr.max) end |
#mean ⇒ Expr
Get mean value.
2430 2431 2432 |
# File 'lib/polars/expr.rb', line 2430 def mean wrap_expr(_rbexpr.mean) end |
#median ⇒ Expr
Get median value using linear interpolation.
2450 2451 2452 |
# File 'lib/polars/expr.rb', line 2450 def median wrap_expr(_rbexpr.median) end |
#meta ⇒ MetaExpr
Create an object namespace of all meta related expression methods.
8341 8342 8343 |
# File 'lib/polars/expr.rb', line 8341 def MetaExpr.new(self) end |
#min ⇒ Expr
Get minimum value.
2346 2347 2348 |
# File 'lib/polars/expr.rb', line 2346 def min wrap_expr(_rbexpr.min) end |
#mod(other) ⇒ Expr
Method equivalent of modulus operator expr % other
.
4099 4100 4101 |
# File 'lib/polars/expr.rb', line 4099 def mod(other) self % other end |
#mode ⇒ Expr
Compute the most occurring value(s).
Can return multiple Values.
1303 1304 1305 |
# File 'lib/polars/expr.rb', line 1303 def mode wrap_expr(_rbexpr.mode) end |
#mul(other) ⇒ Expr
Method equivalent of multiplication operator expr * other
.
4129 4130 4131 |
# File 'lib/polars/expr.rb', line 4129 def mul(other) self * other end |
#n_unique ⇒ Expr
Count unique values.
2490 2491 2492 |
# File 'lib/polars/expr.rb', line 2490 def n_unique wrap_expr(_rbexpr.n_unique) end |
#name ⇒ NameExpr
Create an object namespace of all expressions that modify expression names.
8348 8349 8350 |
# File 'lib/polars/expr.rb', line 8348 def name NameExpr.new(self) end |
#nan_max ⇒ Expr
Get maximum value, but propagate/poison encountered NaN values.
2366 2367 2368 |
# File 'lib/polars/expr.rb', line 2366 def nan_max wrap_expr(_rbexpr.nan_max) end |
#nan_min ⇒ Expr
Get minimum value, but propagate/poison encountered NaN values.
2386 2387 2388 |
# File 'lib/polars/expr.rb', line 2386 def nan_min wrap_expr(_rbexpr.nan_min) end |
#ne(other) ⇒ Expr
Method equivalent of inequality operator expr != other
.
3956 3957 3958 |
# File 'lib/polars/expr.rb', line 3956 def ne(other) self != other end |
#ne_missing(other) ⇒ Expr
Method equivalent of equality operator expr != other
where nil == nil
.
This differs from default ne
where null values are propagated.
3994 3995 3996 3997 |
# File 'lib/polars/expr.rb', line 3994 def ne_missing(other) other = Utils.parse_into_expression(other, str_as_lit: true) wrap_expr(_rbexpr.neq_missing(other)) end |
#neg ⇒ Expr
Method equivalent of unary minus operator -expr
.
4182 4183 4184 |
# File 'lib/polars/expr.rb', line 4182 def neg -self end |
#null_count ⇒ Expr
Count null values.
2538 2539 2540 |
# File 'lib/polars/expr.rb', line 2538 def null_count wrap_expr(_rbexpr.null_count) end |
#or_(*others) ⇒ Expr
Method equivalent of bitwise "or" operator expr | other | ...
.
3720 3721 3722 |
# File 'lib/polars/expr.rb', line 3720 def or_(*others) ([self] + others).reduce(:|) end |
#over(expr) ⇒ Expr
Apply window function over a subgroup.
This is similar to a group by + aggregation + self join. Or similar to window functions in Postgres.
2735 2736 2737 2738 |
# File 'lib/polars/expr.rb', line 2735 def over(expr) rbexprs = Utils.parse_into_list_of_expressions(expr) wrap_expr(_rbexpr.over(rbexprs)) end |
#pct_change(n: 1) ⇒ Expr
Computes percentage change between values.
Percentage change (as fraction) between current element and most-recent
non-null element at least n
period(s) before the current element.
Computes the change from the previous row by default.
6586 6587 6588 6589 |
# File 'lib/polars/expr.rb', line 6586 def pct_change(n: 1) n = Utils.parse_into_expression(n) wrap_expr(_rbexpr.pct_change(n)) end |
#peak_max ⇒ Expr
Get a boolean mask of the local maximum peaks.
2960 2961 2962 |
# File 'lib/polars/expr.rb', line 2960 def peak_max wrap_expr(_rbexpr.peak_max) end |
#peak_min ⇒ Expr
Get a boolean mask of the local minimum peaks.
2984 2985 2986 |
# File 'lib/polars/expr.rb', line 2984 def peak_min wrap_expr(_rbexpr.peak_min) end |
#pow(exponent) ⇒ Expr
Raise expression to the power of exponent.
4240 4241 4242 |
# File 'lib/polars/expr.rb', line 4240 def pow(exponent) self**exponent end |
#prefix(prefix) ⇒ Expr
Add a prefix to the root column name of the expression.
469 470 471 |
# File 'lib/polars/expr.rb', line 469 def prefix(prefix) name.prefix(prefix) end |
#product ⇒ Expr
Compute the product of an expression.
2470 2471 2472 |
# File 'lib/polars/expr.rb', line 2470 def product wrap_expr(_rbexpr.product) end |
#qcut(quantiles, labels: nil, left_closed: false, allow_duplicates: false, include_breaks: false) ⇒ Expr
Bin continuous values into discrete categories based on their quantiles.
3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 |
# File 'lib/polars/expr.rb', line 3195 def qcut(quantiles, labels: nil, left_closed: false, allow_duplicates: false, include_breaks: false) if quantiles.is_a?(Integer) rbexpr = _rbexpr.qcut_uniform( quantiles, labels, left_closed, allow_duplicates, include_breaks ) else rbexpr = _rbexpr.qcut( quantiles, labels, left_closed, allow_duplicates, include_breaks ) end wrap_expr(rbexpr) end |
#quantile(quantile, interpolation: "nearest") ⇒ Expr
Get quantile value.
3057 3058 3059 3060 |
# File 'lib/polars/expr.rb', line 3057 def quantile(quantile, interpolation: "nearest") quantile = Utils.parse_into_expression(quantile, str_as_lit: false) wrap_expr(_rbexpr.quantile(quantile, interpolation)) end |
#radians ⇒ Expr
Convert from degrees to radians.
7133 7134 7135 |
# File 'lib/polars/expr.rb', line 7133 def radians wrap_expr(_rbexpr.radians) end |
#rank(method: "average", reverse: false, seed: nil) ⇒ Expr
Assign ranks to data, dealing with ties appropriately.
6518 6519 6520 |
# File 'lib/polars/expr.rb', line 6518 def rank(method: "average", reverse: false, seed: nil) wrap_expr(_rbexpr.rank(method, reverse, seed)) end |
#rechunk ⇒ Expr
Create a single chunk of memory for this Series.
914 915 916 |
# File 'lib/polars/expr.rb', line 914 def rechunk wrap_expr(_rbexpr.rechunk) end |
#reinterpret(signed: false) ⇒ Expr
Reinterpret the underlying bits as a signed/unsigned integer.
This operation is only allowed for 64bit integers. For lower bits integers, you can safely use that cast operation.
4522 4523 4524 |
# File 'lib/polars/expr.rb', line 4522 def reinterpret(signed: false) wrap_expr(_rbexpr.reinterpret(signed)) end |
#repeat_by(by) ⇒ Expr
Repeat the elements in this Series as specified in the given expression.
The repeated elements are expanded into a List
.
4333 4334 4335 4336 |
# File 'lib/polars/expr.rb', line 4333 def repeat_by(by) by = Utils.parse_into_expression(by, str_as_lit: false) wrap_expr(_rbexpr.repeat_by(by)) end |
#replace(old, new = NO_DEFAULT, default: NO_DEFAULT, return_dtype: nil) ⇒ Expr
Replace values by different values.
7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 |
# File 'lib/polars/expr.rb', line 7976 def replace(old, new = NO_DEFAULT, default: NO_DEFAULT, return_dtype: nil) if !default.eql?(NO_DEFAULT) return replace_strict(old, new, default: default, return_dtype: return_dtype) end if new.eql?(NO_DEFAULT) && old.is_a?(Hash) new = Series.new(old.values) old = Series.new(old.keys) else if old.is_a?(::Array) old = Series.new(old) end if new.is_a?(::Array) new = Series.new(new) end end old = Utils.parse_into_expression(old, str_as_lit: true) new = Utils.parse_into_expression(new, str_as_lit: true) result = wrap_expr(_rbexpr.replace(old, new)) if !return_dtype.nil? result = result.cast(return_dtype) end result end |
#replace_strict(old, new = NO_DEFAULT, default: NO_DEFAULT, return_dtype: nil) ⇒ Expr
The global string cache must be enabled when replacing categorical values.
Replace all values by different values.
8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 |
# File 'lib/polars/expr.rb', line 8132 def replace_strict( old, new = NO_DEFAULT, default: NO_DEFAULT, return_dtype: nil ) if new.eql?(NO_DEFAULT) && old.is_a?(Hash) new = Series.new(old.values) old = Series.new(old.keys) end old = Utils.parse_into_expression(old, str_as_lit: true, list_as_series: true) new = Utils.parse_into_expression(new, str_as_lit: true, list_as_series: true) default = default.eql?(NO_DEFAULT) ? nil : Utils.parse_into_expression(default, str_as_lit: true) wrap_expr( _rbexpr.replace_strict(old, new, default, return_dtype) ) end |
#reshape(dims) ⇒ Expr
Reshape this Expr to a flat Series or a Series of Lists.
7179 7180 7181 |
# File 'lib/polars/expr.rb', line 7179 def reshape(dims) wrap_expr(_rbexpr.reshape(dims)) end |
#reverse ⇒ Expr
Reverse the selection.
2260 2261 2262 |
# File 'lib/polars/expr.rb', line 2260 def reverse wrap_expr(_rbexpr.reverse) end |
#rle ⇒ Expr
Get the lengths of runs of identical values.
3230 3231 3232 |
# File 'lib/polars/expr.rb', line 3230 def rle wrap_expr(_rbexpr.rle) end |
#rle_id ⇒ Expr
Map values to run IDs.
Similar to RLE, but it maps each value to an ID corresponding to the run into which it falls. This is especially useful when you want to define groups by runs of identical values rather than the values themselves.
3258 3259 3260 |
# File 'lib/polars/expr.rb', line 3258 def rle_id wrap_expr(_rbexpr.rle_id) end |
#rolling(index_column:, period:, offset: nil, closed: "right") ⇒ Expr
Create rolling groups based on a temporal or integer column.
If you have a time series <t_0, t_1, ..., t_n>
, then by default the
windows created will be
- (t_0 - period, t_0]
- (t_1 - period, t_1]
- ...
- (t_n - period, t_n]
whereas if you pass a non-default offset
, then the windows will be
- (t_0 + offset, t_0 + offset + period]
- (t_1 + offset, t_1 + offset + period]
- ...
- (t_n + offset, t_n + offset + period]
The period
and offset
arguments are created either from a timedelta, or
by using the following string language:
- 1ns (1 nanosecond)
- 1us (1 microsecond)
- 1ms (1 millisecond)
- 1s (1 second)
- 1m (1 minute)
- 1h (1 hour)
- 1d (1 calendar day)
- 1w (1 calendar week)
- 1mo (1 calendar month)
- 1q (1 calendar quarter)
- 1y (1 calendar year)
- 1i (1 index count)
Or combine them: "3d12h4m25s" # 3 days, 12 hours, 4 minutes, and 25 seconds
By "calendar day", we mean the corresponding time on the next day (which may not be 24 hours, due to daylight savings). Similarly for "calendar week", "calendar month", "calendar quarter", and "calendar year".
2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 |
# File 'lib/polars/expr.rb', line 2827 def rolling( index_column:, period:, offset: nil, closed: "right" ) if offset.nil? offset = Utils.negate_duration_string(Utils.parse_as_duration_string(period)) end period = Utils.parse_as_duration_string(period) offset = Utils.parse_as_duration_string(offset) wrap_expr(_rbexpr.rolling(index_column, period, offset, closed)) end |
#rolling_kurtosis(window_size, fisher: true, bias: true, min_samples: nil, center: false) ⇒ Expr
This functionality is considered unstable. It may be changed at any point without it being considered a breaking change.
Compute a rolling kurtosis.
The window at a given row will include the row itself, and the window_size - 1
elements before it.
6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 |
# File 'lib/polars/expr.rb', line 6380 def rolling_kurtosis( window_size, fisher: true, bias: true, min_samples: nil, center: false ) wrap_expr( _rbexpr.rolling_kurtosis( window_size, fisher, bias, min_samples, center ) ) end |
#rolling_max(window_size, weights: nil, min_periods: nil, center: false) ⇒ Expr
This functionality is experimental and may change without it being considered a breaking change.
If you want to compute multiple aggregation statistics over the same dynamic
window, consider using group_by_rolling
this method can cache the window size
computation.
Apply a rolling max (moving max) over the values in this array.
A window of length window_size
will traverse the array. The values that fill
this window will (optionally) be multiplied with the weights given by the
weight
vector. The resulting values will be aggregated to their sum.
5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 |
# File 'lib/polars/expr.rb', line 5759 def rolling_max( window_size, weights: nil, min_periods: nil, center: false ) wrap_expr( _rbexpr.rolling_max( window_size, weights, min_periods, center ) ) end |
#rolling_max_by(by, window_size, min_periods: 1, closed: "right", warn_if_unsorted: nil) ⇒ Expr
If you want to compute multiple aggregation statistics over the same dynamic
window, consider using rolling
- this method can cache the window size
computation.
Apply a rolling max based on another column.
4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 |
# File 'lib/polars/expr.rb', line 4838 def rolling_max_by( by, window_size, min_periods: 1, closed: "right", warn_if_unsorted: nil ) window_size = _prepare_rolling_by_window_args(window_size) by = Utils.parse_into_expression(by) wrap_expr( _rbexpr.rolling_max_by(by, window_size, min_periods, closed) ) end |
#rolling_mean(window_size, weights: nil, min_periods: nil, center: false) ⇒ Expr
This functionality is experimental and may change without it being considered a breaking change.
If you want to compute multiple aggregation statistics over the same dynamic
window, consider using group_by_rolling
this method can cache the window size
computation.
Apply a rolling mean (moving mean) over the values in this array.
A window of length window_size
will traverse the array. The values that fill
this window will (optionally) be multiplied with the weights given by the
weight
vector. The resulting values will be aggregated to their sum.
5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 |
# File 'lib/polars/expr.rb', line 5837 def rolling_mean( window_size, weights: nil, min_periods: nil, center: false ) wrap_expr( _rbexpr.rolling_mean( window_size, weights, min_periods, center ) ) end |
#rolling_mean_by(by, window_size, min_periods: 1, closed: "right", warn_if_unsorted: nil) ⇒ Expr
If you want to compute multiple aggregation statistics over the same dynamic
window, consider using rolling
- this method can cache the window size
computation.
Apply a rolling mean based on another column.
4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 |
# File 'lib/polars/expr.rb', line 4969 def rolling_mean_by( by, window_size, min_periods: 1, closed: "right", warn_if_unsorted: nil ) window_size = _prepare_rolling_by_window_args(window_size) by = Utils.parse_into_expression(by) wrap_expr( _rbexpr.rolling_mean_by( by, window_size, min_periods, closed ) ) end |
#rolling_median(window_size, weights: nil, min_periods: nil, center: false) ⇒ Expr
This functionality is experimental and may change without it being considered a breaking change.
If you want to compute multiple aggregation statistics over the same dynamic
window, consider using group_by_rolling
this method can cache the window size
computation.
Compute a rolling median.
6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 |
# File 'lib/polars/expr.rb', line 6151 def rolling_median( window_size, weights: nil, min_periods: nil, center: false ) wrap_expr( _rbexpr.rolling_median( window_size, weights, min_periods, center ) ) end |
#rolling_median_by(by, window_size, min_periods: 1, closed: "right", warn_if_unsorted: nil) ⇒ Expr
If you want to compute multiple aggregation statistics over the same dynamic
window, consider using rolling
- this method can cache the window size
computation.
Compute a rolling median based on another column.
5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 |
# File 'lib/polars/expr.rb', line 5484 def rolling_median_by( by, window_size, min_periods: 1, closed: "right", warn_if_unsorted: nil ) window_size = _prepare_rolling_by_window_args(window_size) by = Utils.parse_into_expression(by) wrap_expr( _rbexpr.rolling_median_by(by, window_size, min_periods, closed) ) end |
#rolling_min(window_size, weights: nil, min_periods: nil, center: false) ⇒ Expr
This functionality is experimental and may change without it being considered a breaking change.
If you want to compute multiple aggregation statistics over the same dynamic
window, consider using group_by_rolling
this method can cache the window size
computation.
Apply a rolling min (moving min) over the values in this array.
A window of length window_size
will traverse the array. The values that fill
this window will (optionally) be multiplied with the weights given by the
weight
vector. The resulting values will be aggregated to their sum.
5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 |
# File 'lib/polars/expr.rb', line 5681 def rolling_min( window_size, weights: nil, min_periods: nil, center: false ) wrap_expr( _rbexpr.rolling_min( window_size, weights, min_periods, center ) ) end |
#rolling_min_by(by, window_size, min_periods: 1, closed: "right", warn_if_unsorted: nil) ⇒ Expr
If you want to compute multiple aggregation statistics over the same dynamic
window, consider using rolling
- this method can cache the window size
computation.
Apply a rolling min based on another column.
4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 |
# File 'lib/polars/expr.rb', line 4709 def rolling_min_by( by, window_size, min_periods: 1, closed: "right", warn_if_unsorted: nil ) window_size = _prepare_rolling_by_window_args(window_size) by = Utils.parse_into_expression(by) wrap_expr( _rbexpr.rolling_min_by(by, window_size, min_periods, closed) ) end |
#rolling_quantile(quantile, interpolation: "nearest", window_size: 2, weights: nil, min_periods: nil, center: false) ⇒ Expr
This functionality is experimental and may change without it being considered a breaking change.
If you want to compute multiple aggregation statistics over the same dynamic
window, consider using group_by_rolling
this method can cache the window size
computation.
Compute a rolling quantile.
6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 |
# File 'lib/polars/expr.rb', line 6229 def rolling_quantile( quantile, interpolation: "nearest", window_size: 2, weights: nil, min_periods: nil, center: false ) wrap_expr( _rbexpr.rolling_quantile( quantile, interpolation, window_size, weights, min_periods, center ) ) end |
#rolling_quantile_by(by, window_size, quantile:, interpolation: "nearest", min_periods: 1, closed: "right", warn_if_unsorted: nil) ⇒ Expr
If you want to compute multiple aggregation statistics over the same dynamic
window, consider using rolling
- this method can cache the window size
computation.
Compute a rolling quantile based on another column.
5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 |
# File 'lib/polars/expr.rb', line 5593 def rolling_quantile_by( by, window_size, quantile:, interpolation: "nearest", min_periods: 1, closed: "right", warn_if_unsorted: nil ) window_size = _prepare_rolling_by_window_args(window_size) by = Utils.parse_into_expression(by) wrap_expr( _rbexpr.rolling_quantile_by( by, quantile, interpolation, window_size, min_periods, closed, ) ) end |
#rolling_skew(window_size, bias: true, min_samples: nil, center: false) ⇒ Expr
Compute a rolling skew.
6337 6338 6339 |
# File 'lib/polars/expr.rb', line 6337 def rolling_skew(window_size, bias: true, min_samples: nil, center: false) wrap_expr(_rbexpr.rolling_skew(window_size, bias, min_samples, center)) end |
#rolling_std(window_size, weights: nil, min_periods: nil, center: false, ddof: 1) ⇒ Expr
This functionality is experimental and may change without it being considered a breaking change.
If you want to compute multiple aggregation statistics over the same dynamic
window, consider using group_by_rolling
this method can cache the window size
computation.
Compute a rolling standard deviation.
A window of length window_size
will traverse the array. The values that fill
this window will (optionally) be multiplied with the weights given by the
weight
vector. The resulting values will be aggregated to their sum.
5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 |
# File 'lib/polars/expr.rb', line 5995 def rolling_std( window_size, weights: nil, min_periods: nil, center: false, ddof: 1 ) wrap_expr( _rbexpr.rolling_std( window_size, weights, min_periods, center, ddof ) ) end |
#rolling_std_by(by, window_size, min_periods: 1, closed: "right", ddof: 1, warn_if_unsorted: nil) ⇒ Expr
If you want to compute multiple aggregation statistics over the same dynamic
window, consider using rolling
- this method can cache the window size
computation.
Compute a rolling standard deviation based on another column.
5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 |
# File 'lib/polars/expr.rb', line 5234 def rolling_std_by( by, window_size, min_periods: 1, closed: "right", ddof: 1, warn_if_unsorted: nil ) window_size = _prepare_rolling_by_window_args(window_size) by = Utils.parse_into_expression(by) wrap_expr( _rbexpr.rolling_std_by( by, window_size, min_periods, closed, ddof ) ) end |
#rolling_sum(window_size, weights: nil, min_periods: nil, center: false) ⇒ Expr
This functionality is experimental and may change without it being considered a breaking change.
If you want to compute multiple aggregation statistics over the same dynamic
window, consider using group_by_rolling
this method can cache the window size
computation.
Apply a rolling sum (moving sum) over the values in this array.
A window of length window_size
will traverse the array. The values that fill
this window will (optionally) be multiplied with the weights given by the
weight
vector. The resulting values will be aggregated to their sum.
5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 |
# File 'lib/polars/expr.rb', line 5915 def rolling_sum( window_size, weights: nil, min_periods: nil, center: false ) wrap_expr( _rbexpr.rolling_sum( window_size, weights, min_periods, center ) ) end |
#rolling_sum_by(by, window_size, min_periods: 1, closed: "right", warn_if_unsorted: nil) ⇒ Expr
If you want to compute multiple aggregation statistics over the same dynamic
window, consider using rolling
- this method can cache the window size
computation.
Apply a rolling sum based on another column.
5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 |
# File 'lib/polars/expr.rb', line 5103 def rolling_sum_by( by, window_size, min_periods: 1, closed: "right", warn_if_unsorted: nil ) window_size = _prepare_rolling_by_window_args(window_size) by = Utils.parse_into_expression(by) wrap_expr( _rbexpr.rolling_sum_by(by, window_size, min_periods, closed) ) end |
#rolling_var(window_size, weights: nil, min_periods: nil, center: false, ddof: 1) ⇒ Expr
This functionality is experimental and may change without it being considered a breaking change.
If you want to compute multiple aggregation statistics over the same dynamic
window, consider using group_by_rolling
this method can cache the window size
computation.
Compute a rolling variance.
A window of length window_size
will traverse the array. The values that fill
this window will (optionally) be multiplied with the weights given by the
weight
vector. The resulting values will be aggregated to their sum.
6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 |
# File 'lib/polars/expr.rb', line 6076 def rolling_var( window_size, weights: nil, min_periods: nil, center: false, ddof: 1 ) wrap_expr( _rbexpr.rolling_var( window_size, weights, min_periods, center, ddof ) ) end |
#rolling_var_by(by, window_size, min_periods: 1, closed: "right", ddof: 1, warn_if_unsorted: nil) ⇒ Expr
If you want to compute multiple aggregation statistics over the same dynamic
window, consider using rolling
- this method can cache the window size
computation.
Compute a rolling variance based on another column.
5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 |
# File 'lib/polars/expr.rb', line 5372 def rolling_var_by( by, window_size, min_periods: 1, closed: "right", ddof: 1, warn_if_unsorted: nil ) window_size = _prepare_rolling_by_window_args(window_size) by = Utils.parse_into_expression(by) wrap_expr( _rbexpr.rolling_var_by( by, window_size, min_periods, closed, ddof ) ) end |
#round(decimals = 0, mode: "half_to_even") ⇒ Expr
Round underlying floating point data by decimals
digits.
1221 1222 1223 |
# File 'lib/polars/expr.rb', line 1221 def round(decimals = 0, mode: "half_to_even") wrap_expr(_rbexpr.round(decimals, mode)) end |
#round_sig_figs(digits) ⇒ Expr
Round to a number of significant figures.
1246 1247 1248 |
# File 'lib/polars/expr.rb', line 1246 def round_sig_figs(digits) wrap_expr(_rbexpr.round_sig_figs(digits)) end |
#sample(frac: nil, with_replacement: true, shuffle: false, seed: nil, n: nil) ⇒ Expr
Sample from this expression.
7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 |
# File 'lib/polars/expr.rb', line 7242 def sample( frac: nil, with_replacement: true, shuffle: false, seed: nil, n: nil ) if !n.nil? && !frac.nil? raise ArgumentError, "cannot specify both `n` and `frac`" end if !n.nil? && frac.nil? n = Utils.parse_into_expression(n) return wrap_expr(_rbexpr.sample_n(n, with_replacement, shuffle, seed)) end if frac.nil? frac = 1.0 end frac = Utils.parse_into_expression(frac) wrap_expr( _rbexpr.sample_frac(frac, with_replacement, shuffle, seed) ) end |
#search_sorted(element, side: "any", descending: false) ⇒ Expr
Find indices where elements should be inserted to maintain order.
1856 1857 1858 1859 |
# File 'lib/polars/expr.rb', line 1856 def search_sorted(element, side: "any", descending: false) element = Utils.parse_into_expression(element, str_as_lit: false) wrap_expr(_rbexpr.search_sorted(element, side, descending)) end |
#set_sorted(descending: false) ⇒ Expr
This can lead to incorrect results if this Series
is not sorted!!
Use with care!
Flags the expression as 'sorted'.
Enables downstream code to user fast paths for sorted arrays.
7711 7712 7713 |
# File 'lib/polars/expr.rb', line 7711 def set_sorted(descending: false) wrap_expr(_rbexpr.set_sorted_flag(descending)) end |
#shift(n = 1, fill_value: nil) ⇒ Expr
Shift the values by a given period.
2026 2027 2028 2029 2030 2031 2032 |
# File 'lib/polars/expr.rb', line 2026 def shift(n = 1, fill_value: nil) if !fill_value.nil? fill_value = Utils.parse_into_expression(fill_value, str_as_lit: true) end n = Utils.parse_into_expression(n) wrap_expr(_rbexpr.shift(n, fill_value)) end |
#shift_and_fill(periods, fill_value) ⇒ Expr
Shift the values by a given period and fill the resulting null values.
2058 2059 2060 |
# File 'lib/polars/expr.rb', line 2058 def shift_and_fill(periods, fill_value) shift(periods, fill_value: fill_value) end |
#shrink_dtype ⇒ Expr
Shrink numeric columns to the minimal required datatype.
Shrink to the dtype needed to fit the extrema of this Series
.
This can be used to reduce memory pressure.
7771 7772 7773 |
# File 'lib/polars/expr.rb', line 7771 def shrink_dtype wrap_expr(_rbexpr.shrink_dtype) end |
#shuffle(seed: nil) ⇒ Expr
Shuffle the contents of this expr.
7205 7206 7207 7208 7209 7210 |
# File 'lib/polars/expr.rb', line 7205 def shuffle(seed: nil) if seed.nil? seed = rand(10000) end wrap_expr(_rbexpr.shuffle(seed)) end |
#sign ⇒ Expr
Compute the element-wise indication of the sign.
6817 6818 6819 |
# File 'lib/polars/expr.rb', line 6817 def sign wrap_expr(_rbexpr.sign) end |
#sin ⇒ Expr
Compute the element-wise value for the sine.
6837 6838 6839 |
# File 'lib/polars/expr.rb', line 6837 def sin wrap_expr(_rbexpr.sin) end |
#sinh ⇒ Expr
Compute the element-wise value for the hyperbolic sine.
6977 6978 6979 |
# File 'lib/polars/expr.rb', line 6977 def sinh wrap_expr(_rbexpr.sinh) end |
#skew(bias: true) ⇒ Expr
Compute the sample skewness of a data set.
For normally distributed data, the skewness should be about zero. For
unimodal continuous distributions, a skewness value greater than zero means
that there is more weight in the right tail of the distribution. The
function skewtest
can be used to determine if the skewness value
is close enough to zero, statistically speaking.
6616 6617 6618 |
# File 'lib/polars/expr.rb', line 6616 def skew(bias: true) wrap_expr(_rbexpr.skew(bias)) end |
#slice(offset, length = nil) ⇒ Expr
Get a slice of this expression.
849 850 851 852 853 854 855 856 857 |
# File 'lib/polars/expr.rb', line 849 def slice(offset, length = nil) if !offset.is_a?(Expr) offset = Polars.lit(offset) end if !length.is_a?(Expr) length = Polars.lit(length) end wrap_expr(_rbexpr.slice(offset._rbexpr, length._rbexpr)) end |
#sort(reverse: false, nulls_last: false) ⇒ Expr
Sort this column. In projection/ selection context the whole column is sorted.
If used in a group by context, the groups are sorted.
1417 1418 1419 |
# File 'lib/polars/expr.rb', line 1417 def sort(reverse: false, nulls_last: false) wrap_expr(_rbexpr.sort_with(reverse, nulls_last)) end |
#sort_by(by, *more_by, reverse: false, nulls_last: false, multithreaded: true, maintain_order: false) ⇒ Expr
Sort this column by the ordering of another column, or multiple other columns.
In projection/ selection context the whole column is sorted. If used in a group by context, the groups are sorted.
1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 |
# File 'lib/polars/expr.rb', line 1912 def sort_by(by, *more_by, reverse: false, nulls_last: false, multithreaded: true, maintain_order: false) by = Utils.parse_into_list_of_expressions(by, *more_by) reverse = Utils.extend_bool(reverse, by.length, "reverse", "by") nulls_last = Utils.extend_bool(nulls_last, by.length, "nulls_last", "by") wrap_expr( _rbexpr.sort_by( by, reverse, nulls_last, multithreaded, maintain_order ) ) end |
#sqrt ⇒ Expr
Compute the square root of the elements.
275 276 277 |
# File 'lib/polars/expr.rb', line 275 def sqrt wrap_expr(_rbexpr.sqrt) end |
#std(ddof: 1) ⇒ Expr
Get standard deviation.
2283 2284 2285 |
# File 'lib/polars/expr.rb', line 2283 def std(ddof: 1) wrap_expr(_rbexpr.std(ddof)) end |
#str ⇒ StringExpr
Create an object namespace of all string related methods.
8355 8356 8357 |
# File 'lib/polars/expr.rb', line 8355 def str StringExpr.new(self) end |
#struct ⇒ StructExpr
Create an object namespace of all struct related methods.
8362 8363 8364 |
# File 'lib/polars/expr.rb', line 8362 def struct StructExpr.new(self) end |
#sub(other) ⇒ Expr
Method equivalent of subtraction operator expr - other
.
4159 4160 4161 |
# File 'lib/polars/expr.rb', line 4159 def sub(other) self - other end |
#suffix(suffix) ⇒ Expr
Add a suffix to the root column name of the expression.
496 497 498 |
# File 'lib/polars/expr.rb', line 496 def suffix(suffix) name.suffix(suffix) end |
#sum ⇒ Expr
Dtypes in :i8
, :u8
, :i16
, and :u16
are cast to
:i64
before summing to prevent overflow issues.
Get sum value.
2410 2411 2412 |
# File 'lib/polars/expr.rb', line 2410 def sum wrap_expr(_rbexpr.sum) end |
#tail(n = 10) ⇒ Expr
Get the last n
rows.
3610 3611 3612 |
# File 'lib/polars/expr.rb', line 3610 def tail(n = 10) wrap_expr(_rbexpr.tail(n)) end |
#tan ⇒ Expr
Compute the element-wise value for the tangent.
6877 6878 6879 |
# File 'lib/polars/expr.rb', line 6877 def tan wrap_expr(_rbexpr.tan) end |
#tanh ⇒ Expr
Compute the element-wise value for the hyperbolic tangent.
7017 7018 7019 |
# File 'lib/polars/expr.rb', line 7017 def tanh wrap_expr(_rbexpr.tanh) end |
#to_physical ⇒ Expr
Cast to physical representation of the logical dtype.
:date
->:i32
:datetime
->:i64
:time
->:i64
:duration
->:i64
:cat
->:u32
- Other data types will be left unchanged.
182 183 184 |
# File 'lib/polars/expr.rb', line 182 def to_physical wrap_expr(_rbexpr.to_physical) end |
#to_s ⇒ String Also known as: inspect
Returns a string representing the Expr.
20 21 22 |
# File 'lib/polars/expr.rb', line 20 def to_s _rbexpr.to_str end |
#top_k(k: 5) ⇒ Expr
Return the k
largest elements.
If 'reverse: true` the smallest elements will be given.
1455 1456 1457 1458 |
# File 'lib/polars/expr.rb', line 1455 def top_k(k: 5) k = Utils.parse_into_expression(k) wrap_expr(_rbexpr.top_k(k)) end |
#top_k_by(by, k: 5, reverse: false) ⇒ Expr
Return the elements corresponding to the k
largest elements of the by
column(s).
Non-null elements are always preferred over null elements, regardless of
the value of reverse
. The output is not guaranteed to be in any
particular order, call :func:sort
after this function if you wish the
output to be sorted.
1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 |
# File 'lib/polars/expr.rb', line 1555 def top_k_by( by, k: 5, reverse: false ) k = Utils.parse_into_expression(k) by = Utils.parse_into_list_of_expressions(by) reverse = Utils.extend_bool(reverse, by.length, "reverse", "by") wrap_expr(_rbexpr.top_k_by(by, k, reverse)) end |
#truediv(other) ⇒ Expr
Method equivalent of float division operator expr / other
.
4214 4215 4216 |
# File 'lib/polars/expr.rb', line 4214 def truediv(other) self / other end |
#unique(maintain_order: false) ⇒ Expr
Get unique values of this expression.
2628 2629 2630 2631 2632 2633 2634 |
# File 'lib/polars/expr.rb', line 2628 def unique(maintain_order: false) if maintain_order wrap_expr(_rbexpr.unique_stable) else wrap_expr(_rbexpr.unique) end end |
#unique_counts ⇒ Expr
Return a count of the unique values in the order of appearance.
This method differs from value_counts
in that it does not return the
values, only the counts and might be faster
7548 7549 7550 |
# File 'lib/polars/expr.rb', line 7548 def unique_counts wrap_expr(_rbexpr.unique_counts) end |
#upper_bound ⇒ Expr
Calculate the upper bound.
Returns a unit Series with the highest value possible for the dtype of this expression.
6793 6794 6795 |
# File 'lib/polars/expr.rb', line 6793 def upper_bound wrap_expr(_rbexpr.upper_bound) end |
#value_counts(sort: false, parallel: false, name: nil, normalize: false) ⇒ Expr
Count all unique values and create a struct mapping value to count.
7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 |
# File 'lib/polars/expr.rb', line 7501 def value_counts( sort: false, parallel: false, name: nil, normalize: false ) if name.nil? if normalize name = "proportion" else name = "count" end end wrap_expr( _rbexpr.value_counts(sort, parallel, name, normalize) ) end |
#var(ddof: 1) ⇒ Expr
Get variance.
2306 2307 2308 |
# File 'lib/polars/expr.rb', line 2306 def var(ddof: 1) wrap_expr(_rbexpr.var(ddof)) end |
#where(predicate) ⇒ Expr
Filter a single column.
Alias for #filter.
3335 3336 3337 |
# File 'lib/polars/expr.rb', line 3335 def where(predicate) filter(predicate) end |
#xor(other) ⇒ Expr
Method equivalent of bitwise exclusive-or operator expr ^ other
.
4268 4269 4270 |
# File 'lib/polars/expr.rb', line 4268 def xor(other) self ^ other end |
#|(other) ⇒ Expr
Bitwise OR.
44 45 46 47 |
# File 'lib/polars/expr.rb', line 44 def |(other) other = Utils.parse_into_expression(other) wrap_expr(_rbexpr.or_(other)) end |