I have the following dataframe with datetime index:
>df
DEtoDK DKtoDE
datetime
2021-01-01 00:00:00 2500.0 2500.0
2021-01-01 01:00:00 2500.0 2500.0
2021-01-01 02:00:00 2500.0 2500.0
however, I don't like how it looks like and it restricts me calling two column values together (for example I want to call DEtoDK
and DKtoDE
together). Therefore I would like to group two columns DEtoDK
and DKtoDE
together into a master column A
.
How can I do that?
Expected Outcome:
>df
A
DEtoDK DKtoDE
datetime
2021-01-01 00:00:00 2500.0 2500.0
2021-01-01 01:00:00 2500.0 2500.0
2021-01-01 02:00:00 2500.0 2500.0
EDIT:
It can be done easily by Multi-Column by tuples via How to do Multi-Column from_tuples? , however if I don't have tuples is it not possible?