Set-up
I have a pandas dataframe df consisting out of multiple columns, with headers like,
| id | x, single room | x, double room | y, single room | y, double room |
--------------------------------------------------------------------------
⋮ ⋮ ⋮ ⋮ ⋮
Problem
I'd like to group the columns starting with x and starting with y under headers in the following way,
| x | y |
--------------------------------------------------------------
| id | single room | double room | single room | double room |
--------------------------------------------------------------
⋮ ⋮ ⋮ ⋮ ⋮
How do I go about?