List#

The following methods are available under the expr.list attribute.

Expr.list.all()

Evaluate whether all boolean values in a list are true.

Expr.list.any()

Evaluate whether any boolean value in a list is true.

Expr.list.drop_nulls()

Drop all null values in the list.

Expr.list.arg_max()

Retrieve the index of the maximum value in every sublist.

Expr.list.arg_min()

Retrieve the index of the minimal value in every sublist.

Expr.list.concat(other)

Concat the arrays in a Series dtype List in linear time.

Expr.list.contains(item)

Check if sublists contain the given item.

Expr.list.count_match(element)

Count how often the value produced by element occurs.

Expr.list.count_matches(element)

Count how often the value produced by element occurs.

Expr.list.diff([n, null_behavior])

Calculate the first discrete difference between shifted items of every sublist.

Expr.list.eval(expr, *[, parallel])

Run any polars expression against the lists' elements.

Expr.list.explode()

Returns a column with a separate row for every list element.

Expr.list.first()

Get the first value of the sublists.

Expr.list.gather(indices, *[, null_on_oob])

Take sublists by multiple indices.

Expr.list.get(index)

Get the value by index in the sublists.

Expr.list.head([n])

Slice the first n values of every sublist.

Expr.list.join(separator, *[, ignore_nulls])

Join all string items in a sublist and place a separator between them.

Expr.list.last()

Get the last value of the sublists.

Expr.list.len()

Return the number of elements in each list.

Expr.list.lengths()

Return the number of elements in each list.

Expr.list.max()

Compute the max value of the lists in the array.

Expr.list.mean()

Compute the mean value of the lists in the array.

Expr.list.median()

Compute the median value of the lists in the array.

Expr.list.min()

Compute the min value of the lists in the array.

Expr.list.reverse()

Reverse the arrays in the list.

Expr.list.sample([n, fraction, ...])

Sample from this list.

Expr.list.set_difference(other)

Compute the SET DIFFERENCE between the elements in this list and the elements of other.

Expr.list.set_intersection(other)

Compute the SET INTERSECTION between the elements in this list and the elements of other.

Expr.list.set_symmetric_difference(other)

Compute the SET SYMMETRIC DIFFERENCE between the elements in this list and the elements of other.

Expr.list.set_union(other)

Compute the SET UNION between the elements in this list and the elements of other.

Expr.list.shift([n])

Shift list values by the given number of indices.

Expr.list.slice(offset[, length])

Slice every sublist.

Expr.list.sort(*[, descending, nulls_last])

Sort the lists in this column.

Expr.list.std([ddof])

Compute the std value of the lists in the array.

Expr.list.sum()

Sum all the lists in the array.

Expr.list.tail([n])

Slice the last n values of every sublist.

Expr.list.take(indices, *[, null_on_oob])

Take sublists by multiple indices.

Expr.list.to_array(width)

Convert a List column into an Array column with the same inner data type.

Expr.list.to_struct([n_field_strategy, ...])

Convert the Series of type List to a Series of type Struct.

Expr.list.unique(*[, maintain_order])

Get the unique/distinct values in the list.

Expr.list.n_unique()

Count the number of unique values in every sub-lists.

Expr.list.var([ddof])

Compute the var value of the lists in the array.

Expr.list.gather_every(n[, offset])

Take every n-th value start from offset in sublists.