polars.Series.index_of#

Series.index_of(element: IntoExpr) int | None[source]#

Get the index of the first occurrence of a value, or None if it’s not found.

Parameters:
element

Value to find.

Examples

>>> s = pl.Series("a", [1, None, 17])
>>> s.index_of(17)
2
>>> s.index_of(None)  # search for a null
1
>>> s.index_of(55) is None
True