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.
-
#count_matches(element) ⇒ Series
Count how often the value produced by
element
occurs. -
#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) ⇒ Series
Run any polars expression against the lists' elements.
-
#explode ⇒ Series
Returns a column with a separate row for every list element.
-
#filter(predicate) ⇒ Series
Filter elements in each list by a boolean expression, returning a new Series of lists.
-
#first ⇒ Series
Get the first value of the sublists.
-
#gather(indices, null_on_oob: false) ⇒ Series
Take sublists by multiple indices.
-
#gather_every(n, offset = 0) ⇒ Series
Take every n-th value start from offset in 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.
-
#len ⇒ Series
(also: #lengths)
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.
-
#median ⇒ Series
Compute the median value of the arrays in the list.
-
#min ⇒ Series
Compute the min value of the arrays in the list.
-
#n_unique ⇒ Series
Count the number of unique values in every sub-lists.
-
#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.
-
#set_difference(other) ⇒ Series
Compute the SET DIFFERENCE between the elements in this list and the elements of
other
. -
#set_intersection(other) ⇒ Series
Compute the SET INTERSECTION between the elements in this list and the elements of
other
. -
#set_symmetric_difference(other) ⇒ Series
Compute the SET SYMMETRIC DIFFERENCE between the elements in this list and the elements of
other
. -
#set_union(other) ⇒ Series
Compute the SET UNION between the elements in this list and the elements of
other
. -
#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.
-
#std(ddof: 1) ⇒ Series
Compute the std value of 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_array(width) ⇒ Series
Convert a List column into an Array column with the same inner data type.
-
#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.
-
#var(ddof: 1) ⇒ Series
Compute the var value of the arrays 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.
454 455 456 |
# File 'lib/polars/list_name_space.rb', line 454 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.
573 574 575 |
# File 'lib/polars/list_name_space.rb', line 573 def arg_max super end |
#arg_min ⇒ Series
Retrieve the index of the minimal value in every sublist.
555 556 557 |
# File 'lib/polars/list_name_space.rb', line 555 def arg_min super end |
#concat(other) ⇒ Series
Concat the arrays in a Series dtype List in linear time.
360 361 362 |
# File 'lib/polars/list_name_space.rb', line 360 def concat(other) super end |
#contains(item) ⇒ Series
Check if sublists contain the given item.
537 538 539 |
# File 'lib/polars/list_name_space.rb', line 537 def contains(item) super end |
#count_matches(element) ⇒ Series
Count how often the value produced by element
occurs.
729 730 731 |
# File 'lib/polars/list_name_space.rb', line 729 def count_matches(element) super end |
#diff(n: 1, null_behavior: "ignore") ⇒ Series
Calculate the n-th discrete difference of every sublist.
596 597 598 |
# File 'lib/polars/list_name_space.rb', line 596 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.
99 100 101 |
# File 'lib/polars/list_name_space.rb', line 99 def drop_nulls super end |
#eval(expr) ⇒ Series
Run any polars expression against the lists' elements.
805 806 807 |
# File 'lib/polars/list_name_space.rb', line 805 def eval(expr) super end |
#explode ⇒ Series
Returns a column with a separate row for every list element.
705 706 707 |
# File 'lib/polars/list_name_space.rb', line 705 def explode super end |
#filter(predicate) ⇒ Series
Filter elements in each list by a boolean expression, returning a new Series of lists.
828 829 830 |
# File 'lib/polars/list_name_space.rb', line 828 def filter(predicate) super end |
#first ⇒ Series
Get the first value of the sublists.
496 497 498 |
# File 'lib/polars/list_name_space.rb', line 496 def first super end |
#gather(indices, null_on_oob: false) ⇒ Series
Take sublists by multiple indices.
The indices may be defined in a single column, or by sublists in another
column of dtype List
.
420 421 422 423 424 425 |
# File 'lib/polars/list_name_space.rb', line 420 def gather( indices, null_on_oob: false ) super end |
#gather_every(n, offset = 0) ⇒ Series
Take every n-th value start from offset in sublists.
447 448 449 |
# File 'lib/polars/list_name_space.rb', line 447 def gather_every(n, offset = 0) 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 nil
.
390 391 392 |
# File 'lib/polars/list_name_space.rb', line 390 def get(index, null_on_oob: false) super end |
#head(n = 5) ⇒ Series
Slice the first n
values of every sublist.
662 663 664 |
# File 'lib/polars/list_name_space.rb', line 662 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
.
477 478 479 |
# File 'lib/polars/list_name_space.rb', line 477 def join(separator) super end |
#last ⇒ Series
Get the last value of the sublists.
515 516 517 |
# File 'lib/polars/list_name_space.rb', line 515 def last super end |
#len ⇒ Series Also known as: lengths
Get the length of the arrays as UInt32.
77 78 79 |
# File 'lib/polars/list_name_space.rb', line 77 def len super end |
#max ⇒ Series
Compute the max value of the arrays in the list.
166 167 168 |
# File 'lib/polars/list_name_space.rb', line 166 def max super end |
#mean ⇒ Series
Compute the mean value of the arrays in the list.
202 203 204 |
# File 'lib/polars/list_name_space.rb', line 202 def mean super end |
#median ⇒ Series
Compute the median value of the arrays in the list.
220 221 222 |
# File 'lib/polars/list_name_space.rb', line 220 def median super end |
#min ⇒ Series
Compute the min value of the arrays in the list.
184 185 186 |
# File 'lib/polars/list_name_space.rb', line 184 def min super end |
#n_unique ⇒ Series
Count the number of unique values in every sub-lists.
338 339 340 |
# File 'lib/polars/list_name_space.rb', line 338 def n_unique super end |
#reverse ⇒ Series
Reverse the arrays in the list.
302 303 304 |
# File 'lib/polars/list_name_space.rb', line 302 def reverse super end |
#sample(n: nil, fraction: nil, with_replacement: false, shuffle: false, seed: nil) ⇒ Series
Sample from this list.
130 131 132 |
# File 'lib/polars/list_name_space.rb', line 130 def sample(n: nil, fraction: nil, with_replacement: false, shuffle: false, seed: nil) super end |
#set_difference(other) ⇒ Series
Compute the SET DIFFERENCE between the elements in this list and the elements of other
.
876 877 878 |
# File 'lib/polars/list_name_space.rb', line 876 def set_difference(other) super end |
#set_intersection(other) ⇒ Series
Compute the SET INTERSECTION between the elements in this list and the elements of other
.
900 901 902 |
# File 'lib/polars/list_name_space.rb', line 900 def set_intersection(other) super end |
#set_symmetric_difference(other) ⇒ Series
Compute the SET SYMMETRIC DIFFERENCE between the elements in this list and the elements of other
.
924 925 926 |
# File 'lib/polars/list_name_space.rb', line 924 def set_symmetric_difference(other) super end |
#set_union(other) ⇒ Series
Compute the SET UNION between the elements in this list and the elements of other
.
852 853 854 |
# File 'lib/polars/list_name_space.rb', line 852 def set_union(other) super end |
#shift(periods = 1) ⇒ Series
Shift values by the given period.
617 618 619 |
# File 'lib/polars/list_name_space.rb', line 617 def shift(periods = 1) super end |
#slice(offset, length = nil) ⇒ Series
Slice every sublist.
641 642 643 |
# File 'lib/polars/list_name_space.rb', line 641 def slice(offset, length = nil) super end |
#sort(reverse: false) ⇒ Series
Sort the arrays in the list.
284 285 286 |
# File 'lib/polars/list_name_space.rb', line 284 def sort(reverse: false) super end |
#std(ddof: 1) ⇒ Series
Compute the std value of the arrays in the list.
238 239 240 |
# File 'lib/polars/list_name_space.rb', line 238 def std(ddof: 1) super end |
#sum ⇒ Series
Sum all the arrays in the list.
148 149 150 |
# File 'lib/polars/list_name_space.rb', line 148 def sum super end |
#tail(n = 5) ⇒ Series
Slice the last n
values of every sublist.
683 684 685 |
# File 'lib/polars/list_name_space.rb', line 683 def tail(n = 5) super end |
#to_array(width) ⇒ Series
Convert a List column into an Array column with the same inner data type.
750 751 752 |
# File 'lib/polars/list_name_space.rb', line 750 def to_array(width) 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
.
777 778 779 |
# File 'lib/polars/list_name_space.rb', line 777 def to_struct(n_field_strategy: "first_non_null", name_generator: nil) super end |
#unique ⇒ Series
Get the unique/distinct values in the list.
320 321 322 |
# File 'lib/polars/list_name_space.rb', line 320 def unique super end |
#var(ddof: 1) ⇒ Series
Compute the var value of the arrays in the list.
256 257 258 |
# File 'lib/polars/list_name_space.rb', line 256 def var(ddof: 1) super end |