numpy.searchsorted()

numpy.searchsorted

numpy.searchsorted(a, v, side='left', sorter=None) [source]

Find indices where elements should be inserted to maintain order.

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

Parameters:

a : 1-D array_like

Input array. If sorter is None, then it must be sorted in asce