polars.internals.series.ListNameSpace.slice

ListNameSpace.slice(offset: int, length: int) polars.internals.series.Series

Slice every sublist

Parameters
offset

Take the values from this index offset

length

The length of the slice to take

Examples

>>> s = pl.Series("a", [[1, 2, 3, 4], [10, 2, 1]])
>>> s.arr.slice(1, 2)
shape: (2,)
Series: 'a' [list]
[
    [2, 3]
    [2, 1]
]