I have something like this:
XY UV BC Val
0 y u c 11
1 y u b 22
2 y v c 33
3 y v b 44
4 x u c 111
5 x u b 222
6 x v c 333
7 x v b 444
I'd like to get
XY UV B_Val C_Val
0 y u 22 11
1 y v 44 33
2 x u 222 111
3 x v 444 333
In general, the BC columns above can contain a number of different items, so I need a solution that works in the general case, not only for 2 different values.
I tried writing some code that splits the dataframe, than re-joins the separate parts, but it started looking too complicated, and it wasn't going anywhere.