I have many large (>100,000,000) lists of integers that contain many duplicates. I want to get the indices where each of the element occur. Currently I am doing something li
def to_components(index): return np.split(np.argsort(index), np.cumsum(np.unique(index, return_counts=True)[1]))