I have this dataframe that I would like to flip
M1 M2 M3
John 0.10 0.74 0.25
Alex 0.80 0.15 0.05
I would like to convert it to this format:
M value
John M1 0.10
John M2 0.74
John M3 0.25
Alex M1 0.80
Alex M2 0.15
Alex M3 0.05
If there an efficient way to do this?