I essentially would like to replicate this image from Jiao2020:
Having a glimpse at my data we have:
day hour consumption
0 Tuesday 17 -0.003196
1 Saturday 8 0.000000
2 Wednesday 17 0.000000
3 Tuesday 16 -0.002542
4 Tuesday 15 0.000000
RangeIndex: 402 entries, 0 to 401
Data columns (total 3 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 day_start 402 non-null category
1 hour_start 402 non-null int64
2 consumption 402 non-null float64
I'd like to have day on the y-axis, hour on the x-axis, and consumption as the value being measured.
To plot it I'm simply trying:
sns.heatmap(df)
plt.show()
but I get the error:
ValueError: could not convert string to float: 'Tuesday'
I've seen posts to leave the day as a da number instead of string, but I'd like to show the days' names on the plot instead of their numbers. How can this plot be achieved?
NOTE: My original timestamp (before extracting information from it) is given in the format "%Y-%m-%d %H:%M:%S.%f". For example, 2021-06-15 17:49:57.828.