Class: Polars::ListNameSpace
- Inherits:
-
Object
- Object
- Polars::ListNameSpace
- Defined in:
- lib/polars/list_name_space.rb
Overview
Series.list namespace.
Instance Method Summary collapse
-
#[](item) ⇒ Series
Get the value by index in the sublists.
-
#all ⇒ Series
Evaluate whether all boolean values in a list are true.
-
#any ⇒ Series
Evaluate whether any boolean value in a list is true.
-
#arg_max ⇒ Series
Retrieve the index of the maximum value in every sublist.
-
#arg_min ⇒ Series
Retrieve the index of the minimal value in every sublist.
-
#concat(other) ⇒ Series
Concat the arrays in a Series dtype List in linear time.
-
#contains(item) ⇒ Series
Check if sublists contain the given item.
-
#diff(n: 1, null_behavior: "ignore") ⇒ Series
Calculate the n-th discrete difference of every sublist.
-
#drop_nulls ⇒ Series
Drop all null values in the list.
-
#eval(expr, parallel: false) ⇒ Series
Run any polars expression against the lists' elements.
-
#first ⇒ Series
Get the first value of the sublists.
-
#get(index, null_on_oob: false) ⇒ Series
Get the value by index in the sublists.
-
#head(n = 5) ⇒ Series
Slice the first
n
values of every sublist. -
#join(separator) ⇒ Series
Join all string items in a sublist and place a separator between them.
-
#last ⇒ Series
Get the last value of the sublists.
-
#lengths ⇒ Series
Get the length of the arrays as UInt32.
-
#max ⇒ Series
Compute the max value of the arrays in the list.
-
#mean ⇒ Series
Compute the mean value of the arrays in the list.
-
#min ⇒ Series
Compute the min value of the arrays in the list.
-
#reverse ⇒ Series
Reverse the arrays in the list.
-
#sample(n: nil, fraction: nil, with_replacement: false, shuffle: false, seed: nil) ⇒ Series
Sample from this list.
-
#shift(periods = 1) ⇒ Series
Shift values by the given period.
-
#slice(offset, length = nil) ⇒ Series
Slice every sublist.
-
#sort(reverse: false) ⇒ Series
Sort the arrays in the list.
-
#sum ⇒ Series
Sum all the arrays in the list.
-
#tail(n = 5) ⇒ Series
Slice the last
n
values of every sublist. -
#to_struct(n_field_strategy: "first_non_null", name_generator: nil) ⇒ Series
Convert the series of type
List
to a series of typeStruct
. -
#unique ⇒ Series
Get the unique/distinct values in the list.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Polars::ExprDispatch
Instance Method Details
#[](item) ⇒ Series
Get the value by index in the sublists.
324 325 326 |
# File 'lib/polars/list_name_space.rb', line 324 def [](item) get(item) end |
#all ⇒ Series
Evaluate whether all boolean values in a list are true.
34 35 36 |
# File 'lib/polars/list_name_space.rb', line 34 def all super end |
#any ⇒ Series
Evaluate whether any boolean value in a list is true.
59 60 61 |
# File 'lib/polars/list_name_space.rb', line 59 def any super end |
#arg_max ⇒ Series
Retrieve the index of the maximum value in every sublist.
443 444 445 |
# File 'lib/polars/list_name_space.rb', line 443 def arg_max super end |
#arg_min ⇒ Series
Retrieve the index of the minimal value in every sublist.
425 426 427 |
# File 'lib/polars/list_name_space.rb', line 425 def arg_min super end |
#concat(other) ⇒ Series
Concat the arrays in a Series dtype List in linear time.
287 288 289 |
# File 'lib/polars/list_name_space.rb', line 287 def concat(other) super end |
#contains(item) ⇒ Series
Check if sublists contain the given item.
407 408 409 |
# File 'lib/polars/list_name_space.rb', line 407 def contains(item) super end |
#diff(n: 1, null_behavior: "ignore") ⇒ Series
Calculate the n-th discrete difference of every sublist.
466 467 468 |
# File 'lib/polars/list_name_space.rb', line 466 def diff(n: 1, null_behavior: "ignore") super end |
#drop_nulls ⇒ Series
Drop all null values in the list.
The original order of the remaining elements is preserved.
98 99 100 |
# File 'lib/polars/list_name_space.rb', line 98 def drop_nulls super end |
#eval(expr, parallel: false) ⇒ Series
Run any polars expression against the lists' elements.
614 615 616 |
# File 'lib/polars/list_name_space.rb', line 614 def eval(expr, parallel: false) super end |
#first ⇒ Series
Get the first value of the sublists.
366 367 368 |
# File 'lib/polars/list_name_space.rb', line 366 def first super end |
#get(index, null_on_oob: false) ⇒ Series
Get the value by index in the sublists.
So index 0
would return the first item of every sublist
and index -1
would return the last item of every sublist
if an index is out of bounds, it will return a None
.
317 318 319 |
# File 'lib/polars/list_name_space.rb', line 317 def get(index, null_on_oob: false) super end |
#head(n = 5) ⇒ Series
Slice the first n
values of every sublist.
532 533 534 |
# File 'lib/polars/list_name_space.rb', line 532 def head(n = 5) super end |
#join(separator) ⇒ Series
Join all string items in a sublist and place a separator between them.
This errors if inner type of list != Utf8
.
347 348 349 |
# File 'lib/polars/list_name_space.rb', line 347 def join(separator) super end |
#last ⇒ Series
Get the last value of the sublists.
385 386 387 |
# File 'lib/polars/list_name_space.rb', line 385 def last super end |
#lengths ⇒ Series
Get the length of the arrays as UInt32.
77 78 79 |
# File 'lib/polars/list_name_space.rb', line 77 def lengths super end |
#max ⇒ Series
Compute the max value of the arrays in the list.
165 166 167 |
# File 'lib/polars/list_name_space.rb', line 165 def max super end |
#mean ⇒ Series
Compute the mean value of the arrays in the list.
201 202 203 |
# File 'lib/polars/list_name_space.rb', line 201 def mean super end |
#min ⇒ Series
Compute the min value of the arrays in the list.
183 184 185 |
# File 'lib/polars/list_name_space.rb', line 183 def min super end |
#reverse ⇒ Series
Reverse the arrays in the list.
247 248 249 |
# File 'lib/polars/list_name_space.rb', line 247 def reverse super end |
#sample(n: nil, fraction: nil, with_replacement: false, shuffle: false, seed: nil) ⇒ Series
Sample from this list.
129 130 131 |
# File 'lib/polars/list_name_space.rb', line 129 def sample(n: nil, fraction: nil, with_replacement: false, shuffle: false, seed: nil) super end |
#shift(periods = 1) ⇒ Series
Shift values by the given period.
487 488 489 |
# File 'lib/polars/list_name_space.rb', line 487 def shift(periods = 1) super end |
#slice(offset, length = nil) ⇒ Series
Slice every sublist.
511 512 513 |
# File 'lib/polars/list_name_space.rb', line 511 def slice(offset, length = nil) super end |
#sort(reverse: false) ⇒ Series
Sort the arrays in the list.
229 230 231 |
# File 'lib/polars/list_name_space.rb', line 229 def sort(reverse: false) super end |
#sum ⇒ Series
Sum all the arrays in the list.
147 148 149 |
# File 'lib/polars/list_name_space.rb', line 147 def sum super end |
#tail(n = 5) ⇒ Series
Slice the last n
values of every sublist.
553 554 555 |
# File 'lib/polars/list_name_space.rb', line 553 def tail(n = 5) super end |
#to_struct(n_field_strategy: "first_non_null", name_generator: nil) ⇒ Series
Convert the series of type List
to a series of type Struct
.
580 581 582 |
# File 'lib/polars/list_name_space.rb', line 580 def to_struct(n_field_strategy: "first_non_null", name_generator: nil) super end |
#unique ⇒ Series
Get the unique/distinct values in the list.
265 266 267 |
# File 'lib/polars/list_name_space.rb', line 265 def unique super end |