DatetimeIndex.searchsorted()

pandas.DatetimeIndex.searchsorted

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

Find indices where elements should be inserted to maintain order.

Find the indices into a sorted DatetimeIndex 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