I have a numpy array of numbers, for example,
a = np.array([1, 3, 5, 6, 9, 10, 14, 15, 56])
I would like to find all the indexes of the
I thought I would add this because the a in the example you gave is sorted:
a
import numpy as np a = [1, 3, 5, 6, 9, 10, 14, 15, 56] start = np.searchsorted(a, 6, 'left') end = np.searchsorted(a, 10, 'right') rng = np.arange(start, end) rng # array([3, 4, 5])