polars.Series.search_sorted#

Series.search_sorted(element: int | float, side: SearchSortedSide = 'any') int[source]#
Series.search_sorted(
element: Series | ndarray[Any, Any] | list[int] | list[float],
side: SearchSortedSide = 'any',
) Series

Find indices where elements should be inserted to maintain order.

\[a[i-1] < v <= a[i]\]
Parameters:
element

Expression or scalar value.

side{‘any’, ‘left’, ‘right’}

If ‘any’, the index of the first suitable location found is given. If ‘left’, the index of the leftmost suitable location found is given. If ‘right’, return the rightmost suitable location found is given.