I have a dataframe like this
L_1 D_1 L_2 D_2 L_3 D_3 C_N
1 Boy Boy||
1 Boy 1-1 play Boy|play|
1 Boy 1-1 play 1-1-21 car Boy|play|car
1 Boy 1-1 play 1-1-1 online Boy|play|online
2 Girl Girl||
2 Girl 2-1 dance Girl|dance|
I have created the C_N tab using the code
df['C_N'] = df[['D_1','D_2', 'D_3']].apply(lambda x: '|'.join(x), axis=1)
Now I would like another column where I can also get the IDs of particular group, my ideal output would be :
L_1 D_1 L_2 D_2 L_3 D_3 IDs C_N
1 Boy 1 Boy||
1 Boy 1-1 play 1-1 Boy|play|
1 Boy 1-1 play 1-1-21 car 1-1-21 Boy|play|car
1 Boy 1-1 play 1-1-1 online 1-1-1 Boy|play|online
2 Girl 2 Girl||
2 Girl 2-1 dance 2-1 Girl|dance|
can anyone help me in this issue. Thank you in advance!
