Skip to content
Advertisement

Multiple Seaborn Heatmaps from Pandas Dataframe

I have a Pandas dataframe that looks like this:

JavaScript

Where there are ~60 stores and the ratings range from 0 – 2. I would like to create a 6×5 grid Seaborn of heatmaps, with one heatmap per store. I would like for the x-axis to be the days and for the y-axis to be the times.

I tried this:

JavaScript

This creates the 5×6 grid, but generates an error (‘Inconsistent shape between the condition and the input…’). What’s the best way to do this?

Advertisement

Answer

For heat map, you need to transpose/pivot your data so as the days becomes columns (x-axis) and times becomes index:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement