Concat the arrays in a Series dtype List in linear time.
Check if sublists contain the given item.
Item that will be checked for membership
Optional
nullBehavior: booleanbool, default True If True, treat null as a distinct value. Null values will not propagate.
Calculate the n-th discrete difference of every sublist.
Optional
n: numbernumber of slots to shift
Optional
nullBehavior: "ignore" | "drop"'ignore' | 'drop'
s = pl.Series("a", [[1, 2, 3, 4], [10, 2, 1]])
s.lst.diff()
shape: (2,)
Series: 'a' [list]
[
[null, 1, ... 1]
[null, -8, -1]
]
>df = pl.DataFrame({"a": [1, 8, 3], "b": [4, 5, 2]})
>df.withColumn(
... pl.concatList(["a", "b"]).lst.eval(pl.first().rank()).alias("rank")
... )
shape: (3, 3)
┌─────┬─────┬────────────┐
│ a ┆ b ┆ rank │
│ --- ┆ --- ┆ --- │
│ i64 ┆ i64 ┆ list [f32] │
╞═════╪═════╪════════════╡
│ 1 ┆ 4 ┆ [1.0, 2.0] │
├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 8 ┆ 5 ┆ [2.0, 1.0] │
├╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌┤
│ 3 ┆ 2 ┆ [2.0, 1.0] │
└─────┴─────┴────────────┘
Get the first value of the sublists.
Slice the head of every sublist
Optional
n: numberHow many values to take in the slice.
Get the last value of the sublists.
Get the length of the sublists.
Get the maximum value of the sublists.
Get the mean value of the sublists.
Get the median value of the sublists.
Reverse the sublists.
Shift the sublists.
Number of periods to shift. Can be positive or negative.
Slice the sublists.
The offset of the slice.
The length of the slice.
Sum all elements of the sublists.
Slice the tail of every sublist
Optional
n: numberHow many values to take in the slice.
Get the unique values of the sublists.
Functions that can be applied to dtype List