polars.Series.item
-
Return the Series as a scalar, or return the element at the given index.
If no index is provided, this is equivalent to
s[0], with a check that the shape is (1,). With an index, this is equivalent tos[index].Examples
>>> s1 = pl.Series("a", [1]) >>> s1.item() 1 >>> s2 = pl.Series("a", [9, 8, 7]) >>> s2.cum_sum().item(-1) 24
Series.item(
index: int | None = None,
) → Any
© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/series/api/polars.Series.item.html