polars.internals.series.ListNameSpace.head

ListNameSpace.head(n: int = 5) polars.internals.series.Series

Slice the head of every sublist

Parameters
n

How many values to take in the slice.

Examples

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