polars.Series.head
-
Get the first
nelements.- Parameters:
-
- n
-
Number of elements to return. If a negative value is passed, return all elements except the last
abs(n).
See also
-
tail,slice
Examples
>>> s = pl.Series("a", [1, 2, 3, 4, 5]) >>> s.head(3) shape: (3,) Series: 'a' [i64] [ 1 2 3 ]Pass a negative value to get all rows
exceptthe lastabs(n).>>> s.head(-3) shape: (2,) Series: 'a' [i64] [ 1 2 ]
Series.head(
n: int = 10,
) → Series
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/series/api/polars.Series.head.html