I have an ndarray of shape (10, 3) and an index list of length 10:
import numpy as np arr = np.arange(10* 3).reshape((10, 3)) idxs = np.array([0, 1, 1, 1, 2, 0, 2