Suppose I have two lists: letters = [a, b, c, d, e, f, g, h, i] and digits = [0, 1, 1, 2, 1, 0, 2, 2, 1, 0]. I would like the final result to be output = [[a, f, i], [b, c, e, i], [d, g, h]].
Here 0, 1 and 2 are just different classes. For instance,a is from class 0 while b and c are from class 1. I just need to put the letters in a sublist according to their class.
I think I can you zip() here and a list comprehension, but I am not sure how to do that. How can I do that using numpy?