I have a df
I have to find all the combinations of Group (let's say 2 pairs) and then have to group them across unique ID's
Output:
Currently I found a way to generate all the combinations but cannot seem to group by unique ID's
I referred to below links as well: Pandas find all combinations of rows under a budget
Code to generate the pairs:
from itertools import combinations
li_4 =[]
for index in list(combinations(df.group.unique(),2)):
li_4.append([index[0],index[1]])