I need to reshape a dataframe like that:
A | B | X | Y |
---|---|---|---|
a1 | b1 | x1 | y1 |
a2 | b2 | x2 | y2 |
to
A | B | Columns1 | result |
---|---|---|---|
a1 | b1 | X | x1 |
a2 | b2 | X | x2 |
a1 | b1 | Y | y1 |
a2 | b2 | Y | y2 |
is there an easy way? I need to avoid an output with pandas multi-index.
Thanks for the suggestions