I have the following pandas dataframe with index titled my_index
my_index | Lunch | Dinner |
---------|-------|--------|
Yes | 100 | 300 |
No | 20 | 400 |
I am trying to reshape or pivot the dataframe so that the my_index becomes the column names and the row values appear as this:
The desired outcome will be:
my_index | Yes | No
------|-----|---
Lunch | 100 | 20
Dinner| 300 | 400
I have tried using pivot_table and pivot but am stumped!
Any pointers in the right direction would be helpful!
Thank you in advance!