Hello,
Within the hover data box, I would like to show a sum of some numerical data which is not related to the shape of the sunburst. However I am currently struggling to work out a way to sum up this data, see example below:
data = {'first_column': ['first_value', 'second_value', 'third_value', 'fourth_value', 'fifth_value', 'fifth_value'],
'second_column': ['North', 'East', 'South', 'West', 'North', 'North'],
'third_column': [1, 1, 1, 1, 1, 1.67],
'fourth_column':[9,9,7,6,5,4]
}
df = pd.DataFrame(data)
fig = px.sunburst(
data_frame=df,
path=["first_column", "second_column"],
color = "first_column",
values="third_column",
color_discrete_sequence=px.colors.qualitative.Pastel,
maxdepth=2,
hover_name="first_column",
hover_data={"fourth_column":True},
template='ggplot2',
)
Ideally, āfourth columnā would show 9 within the hover data, however it seems to throw an error as the āfifth valueā numbers within the āfourth_columnā are different. Does anyone know how I might be able to get āfourth columnā heading within the hover_data to display 9 in this case, or the sum of the āfourth columnā values?