Index.searchsorted()

pandas.Index.searchsorted

Index.searchsorted(key, side='left', sorter=None)

Find indices where elements should be inserted to maintain order.

Find the indices into a sorted IndexOpsMixin self such that, if the corresponding elements in v were inserted before the indices, the order of self would be preserved.

Parameters:

key : array_like

Values to insert into self.

side : {‘left’, ‘right’}, optional

If ‘left’, the index of the first suitable location found is given. If ‘right’, return the last such index. If there is no suitable index, retu