Home > database >  How to transform a pandas dataframe with two index columns and one value column into a heat map?
How to transform a pandas dataframe with two index columns and one value column into a heat map?

Time:04-12

I have a df which looks like this when exported to excel. Where columns A and B a index columns. excel output of df

How to transform into this format? wanted output

CodePudding user response:

Use pandas.DataFrame.unstack

df = df.unstack(level=-1)
  • Related