I would like to extract lists of indexes based on the value of column ID.
data={'ID':[1,1,2,3,6,4,2,6], 'Number': [10,20,5,6,100,90,40,5]}
df=pd.DataFrame(data)
I know how to do that manually, one value/list at a time:
idx_list=df.index[df.ID == 1].tolist()
but in my code, I usually don't know how many different values of ID I have, so the above approach would not be enough. Ideally I would like to have multiple lists as output. for each value of ID, a list of indexes.