polars.internals.series.list.ListNameSpace.head#

ListNameSpace.head(n: int = 5) Series[source]#

Slice the first n values of every sublist.

Parameters:
n

Number of values to return for each sublist.

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]
]