I have a dataframe as given below
data1=[202,701,410,301,402,201,202,301,310,210,302,302,401,402,601,303]
data2=[210,303,500,302,403,202,203,303,400,300,303,310,402,410,203,801]
df = pd.DataFrame(data1,columns = ['data1'])
df['data2'] = data2
which brings me the dataframe. Now I need to group the two columns with parent child relationship like below..
[201, 202, 203, 300, 210, 601],
[801, 301, 302, 303, 400, 310, 701],
[401, 402, 403, 500, 410]
I dont need the exact parent or exact child. I just want to group who all belong to same category in python 3.
Thanks in advance