Class: Polars::ListNameSpace
- Inherits:
-
Object
- Object
- Polars::ListNameSpace
- Defined in:
- lib/polars/list_name_space.rb
Overview
Series.arr namespace.
Instance Method Summary collapse
-
#[](item) ⇒ Series
Get the value by index in the sublists.
-
#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.
-
#eval(expr, parallel: false) ⇒ Series
Run any polars expression against the lists' elements.
-
#first ⇒ Series
Get the first value of the sublists.
-
#get(index) ⇒ 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.
-
#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.
107 108 109 |
# File 'lib/polars/list_name_space.rb', line 107 def [](item) get(item) end |
#arg_max ⇒ Series
Retrieve the index of the maximum value in every sublist.
168 169 170 |
# File 'lib/polars/list_name_space.rb', line 168 def arg_max super end |
#arg_min ⇒ Series
Retrieve the index of the minimal value in every sublist.
161 162 163 |
# File 'lib/polars/list_name_space.rb', line 161 def arg_min super end |
#concat(other) ⇒ Series
Concat the arrays in a Series dtype List in linear time.
86 87 88 |
# File 'lib/polars/list_name_space.rb', line 86 def concat(other) super end |
#contains(item) ⇒ Series
Check if sublists contain the given item.
154 155 156 |
# File 'lib/polars/list_name_space.rb', line 154 def contains(item) super end |
#diff(n: 1, null_behavior: "ignore") ⇒ Series
Calculate the n-th discrete difference of every sublist.
191 192 193 |
# File 'lib/polars/list_name_space.rb', line 191 def diff(n: 1, null_behavior: "ignore") super end |
#eval(expr, parallel: false) ⇒ Series
Run any polars expression against the lists' elements.
342 343 344 |
# File 'lib/polars/list_name_space.rb', line 342 def eval(expr, parallel: false) super end |
#first ⇒ Series
Get the first value of the sublists.
137 138 139 |
# File 'lib/polars/list_name_space.rb', line 137 def first super end |
#get(index) ⇒ 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
.
100 101 102 |
# File 'lib/polars/list_name_space.rb', line 100 def get(index) super end |
#head(n = 5) ⇒ Series
Slice the first n
values of every sublist.
257 258 259 |
# File 'lib/polars/list_name_space.rb', line 257 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
.
130 131 132 |
# File 'lib/polars/list_name_space.rb', line 130 def join(separator) super end |
#last ⇒ Series
Get the last value of the sublists.
144 145 146 |
# File 'lib/polars/list_name_space.rb', line 144 def last super end |
#lengths ⇒ Series
Get the length of the arrays as UInt32.
27 28 29 |
# File 'lib/polars/list_name_space.rb', line 27 def lengths super end |
#max ⇒ Series
Compute the max value of the arrays in the list.
41 42 43 |
# File 'lib/polars/list_name_space.rb', line 41 def max super end |
#mean ⇒ Series
Compute the mean value of the arrays in the list.
55 56 57 |
# File 'lib/polars/list_name_space.rb', line 55 def mean super end |
#min ⇒ Series
Compute the min value of the arrays in the list.
48 49 50 |
# File 'lib/polars/list_name_space.rb', line 48 def min super end |
#reverse ⇒ Series
Reverse the arrays in the list.
69 70 71 |
# File 'lib/polars/list_name_space.rb', line 69 def reverse super end |
#shift(periods = 1) ⇒ Series
Shift values by the given period.
212 213 214 |
# File 'lib/polars/list_name_space.rb', line 212 def shift(periods = 1) super end |
#slice(offset, length = nil) ⇒ Series
Slice every sublist.
236 237 238 |
# File 'lib/polars/list_name_space.rb', line 236 def slice(offset, length = nil) super end |
#sort(reverse: false) ⇒ Series
Sort the arrays in the list.
62 63 64 |
# File 'lib/polars/list_name_space.rb', line 62 def sort(reverse: false) super end |
#sum ⇒ Series
Sum all the arrays in the list.
34 35 36 |
# File 'lib/polars/list_name_space.rb', line 34 def sum super end |
#tail(n = 5) ⇒ Series
Slice the last n
values of every sublist.
278 279 280 |
# File 'lib/polars/list_name_space.rb', line 278 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
.
306 307 308 |
# File 'lib/polars/list_name_space.rb', line 306 def to_struct(n_field_strategy: "first_non_null", name_generator: nil) super end |
#unique ⇒ Series
Get the unique/distinct values in the list.
76 77 78 |
# File 'lib/polars/list_name_space.rb', line 76 def unique super end |