This is a generalization of this question.
I want the fastest way to find, for each element of a
, all the indexes corresponding to this element in b
.
import numpy as np
a = np.array([1, 2, 4])
b = np.array([1, 2, 2, 3, 10, 4, 4, 4])
Here the output would be [[0], [1,2], [5,6,7]]