i have a table in pandas df
id_x id_y
a b
b c
c d
d a
b a
and so on around (1000 rows)
i want to find the total combinations for each id_x with id_y. something like chaining
ie. a has combinations with a-b,b-c,c-d
similarly b has combinations(b-c,c-d,d-a) and also a-b to be considered as a combination for b( a-b = b-a)
and create a dataframe df2 which has
id combinations count
a b,c,d 3
b c,d,a 3
c d,a,b 3
d a,b,c 3
and so on ..(distinct product_id_'s)
and also if i could put each combinations in a different column in dataframe
id c1 c2 c3...&so on count
a b c d 3
b c d a 3
what approach should i follow? my skills on python are at a beginner level. Thanks in advance.
if a->b and b->c and c->dthus chains for a should havea-> b,c,d