I have a pandas dataframe of:
data = {'Metric1':[-0.01, 10.5, -0.08, 10.0],
'Metric2':[-0.04, 1.19, -0.07,6.46],
'Metric3':[0.01, 9.02, -0.06, 8.4],
'Macro':['GDP', 'UR', 'GDP', 'UR'],
'Scenario':['Base', 'Base', "Stress", "Stress"]
}
df = pd.DataFrame(data)
Where my dataframe is long on the 'Scenario' column.
I need my dataframe to maintain this shape, however with the dataframe now wide on the "Scenario" column. This does mean that "Macro" column only has unique values. I prefer if a Multindex dataframe result is given, but its not necessary.
Image below shows result: