Hello! Iām newbie and try to make heatmap with different data aggregations.
I made the dash with sum quantity by weekday and hour
Now, Iām trying to do the same but to show the % ( share of category)
This is example of how I calculate z-values for the heatmap for sum q-ty
What I should change to calculate the share?
z = np.zeros((7, 24))
annotations =
for ind_y, day in enumerate(y_axis):
filtered_day = filtered_df[filtered_df["weekday_add_name"] == day]
for ind_x, x_val in enumerate(x_axis):
sum_of_record = filtered_day[filtered_day["hour_add"] == x_val][
"rec_count"
].sum()
z[ind_y][ind_x] = sum_of_record/ sum_of_record.sum(axis=0)
annotation_dict = dict(
showarrow=False,
text="<b>" + str(sum_of_record) ,
xref="x",
yref="y",
x=x_val,
y=day,
font=dict(family="sans-serif"),
)