I have my input dataframe like this:
df = pd.DataFrame({
'X' : [1],
'Y' : [2],
'Z' : [3],
'A_col1' : [10],
'A_col2' : [20],
'B_col1' : [100],
'B_col2' : [200],
})
How do I convert it into the below format?
final_df = pd.DataFrame({
'X' : [1,1],
'Y' : [2,2],
'X' : [3,3],
'Name' : ['A','B'],
'col1' : [10,20],
'col2' : [100,200]
})
Any help is appreciated