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.
213 214 215 |
# File 'lib/polars/list_name_space.rb', line 213 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.
274 275 276 |
# File 'lib/polars/list_name_space.rb', line 274 def arg_max super end |
#arg_min ⇒ Series
Retrieve the index of the minimal value in every sublist.
267 268 269 |
# File 'lib/polars/list_name_space.rb', line 267 def arg_min super end |
#concat(other) ⇒ Series
Concat the arrays in a Series dtype List in linear time.
188 189 190 |
# File 'lib/polars/list_name_space.rb', line 188 def concat(other) super end |
#contains(item) ⇒ Series
Check if sublists contain the given item.
260 261 262 |
# File 'lib/polars/list_name_space.rb', line 260 def contains(item) super end |
#diff(n: 1, null_behavior: "ignore") ⇒ Series
Calculate the n-th discrete difference of every sublist.
297 298 299 |
# File 'lib/polars/list_name_space.rb', line 297 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.
445 446 447 |
# File 'lib/polars/list_name_space.rb', line 445 def eval(expr, parallel: false) super end |
#first ⇒ Series
Get the first value of the sublists.
243 244 245 |
# File 'lib/polars/list_name_space.rb', line 243 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
.
206 207 208 |
# File 'lib/polars/list_name_space.rb', line 206 def get(index, null_on_oob: false) super end |
#head(n = 5) ⇒ Series
Slice the first n
values of every sublist.
363 364 365 |
# File 'lib/polars/list_name_space.rb', line 363 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
.
236 237 238 |
# File 'lib/polars/list_name_space.rb', line 236 def join(separator) super end |
#last ⇒ Series
Get the last value of the sublists.
250 251 252 |
# File 'lib/polars/list_name_space.rb', line 250 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.
143 144 145 |
# File 'lib/polars/list_name_space.rb', line 143 def max super end |
#mean ⇒ Series
Compute the mean value of the arrays in the list.
157 158 159 |
# File 'lib/polars/list_name_space.rb', line 157 def mean super end |
#min ⇒ Series
Compute the min value of the arrays in the list.
150 151 152 |
# File 'lib/polars/list_name_space.rb', line 150 def min super end |
#reverse ⇒ Series
Reverse the arrays in the list.
171 172 173 |
# File 'lib/polars/list_name_space.rb', line 171 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.
318 319 320 |
# File 'lib/polars/list_name_space.rb', line 318 def shift(periods = 1) super end |
#slice(offset, length = nil) ⇒ Series
Slice every sublist.
342 343 344 |
# File 'lib/polars/list_name_space.rb', line 342 def slice(offset, length = nil) super end |
#sort(reverse: false) ⇒ Series
Sort the arrays in the list.
164 165 166 |
# File 'lib/polars/list_name_space.rb', line 164 def sort(reverse: false) super end |
#sum ⇒ Series
Sum all the arrays in the list.
136 137 138 |
# File 'lib/polars/list_name_space.rb', line 136 def sum super end |
#tail(n = 5) ⇒ Series
Slice the last n
values of every sublist.
384 385 386 |
# File 'lib/polars/list_name_space.rb', line 384 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
.
411 412 413 |
# File 'lib/polars/list_name_space.rb', line 411 def to_struct(n_field_strategy: "first_non_null", name_generator: nil) super end |
#unique ⇒ Series
Get the unique/distinct values in the list.
178 179 180 |
# File 'lib/polars/list_name_space.rb', line 178 def unique super end |