Question:I want to reshape the data so that the values in the index column become the columns
My Data frame:
Is there an easy way to do this? I also have 9 other categorical variables in my data set in addition to the Gender and Location variables. I have only included two variables to keep the example simple.
Code to create the example dataframe:
transposethe dataframe and then
splitand set the new index:
If you have better answer, please add a comment about this, thank you!