Numpy provides various methods for searching different kinds of numerical values, in this article, we will cover two important ones.
1. numpy.where:() It returns the indices of elements in an input array where the given condition is satisfied.
numpy.where(condition[, x, y])
2. numpy.searchsorted(): The function is used to find the indices into a sorted array arr such that, if elements are inserted before the indices, the order of arr would be still preserved. Here, a binary search is used to find the required insertion indices.
numpy.searchsorted(arr, num, side=’left’, sorter=None)