How to add String using format
method of python
inside hover_data
parameter of pie chart
?
Code:
px.pie(df_copy , values = df_copy['success'].value_counts() , names = df_copy['success'].value_counts().index , labels = {0:'Unsuccess' , 1:'Success'} ,color_discrete_sequence = ['blue', 'orange'] , hover_data = [f'Suicide cases: {df_copy['suicide'].value_counts()}'])
Screenshot of Plot:
In the above image the hover_data_0
is where I want my String
(here Suicide cases ) to add, it can be anything what I want user to show on hovering.
And how to change label
value to something string
than digits
here.