I want to pair wise create a new dataframe. I tried using MELT but it did not really work. If you notice columns are pair wise ( i.e code:type , code1:type1 ) I tried creating a list of code columns and list of type columns and then do melt.
How would you suggest this issue? I would appreciate if some explanation is given.
ORIGINAL DATAFRAME:
id Name code code1 code2 type type1 type2
0 ABC 1 4 8 S E T
1 XYZ 2 5 R U
EXPECTED DATAFRAME
id name Code_All Type_All
0 ABC 1 S
0 ABC 4 E
0 ABC 8 T
1 XYZ 2 R
1 XYZ
1 XYZ 5 U