Shown below is the syntax used to get the bar chart for a categorical data on plotly express
df1= df['Catergory'].value_counts().reset_index(name='Total')
df1['Percentage'] = round((df1['Total'] / df1['Total'].sum())* 100,0)
fig = px.bar(df1,
x='index',
y='values',
text_auto= False,
text=df['Percentage'].apply(lambda x: '{0:1.1f}%'.format(x)))
fig.update_traces(textfont_size=12, textangle=0, cliponaxis=False, textposition="outside")
fig.show()
and the diagram looks like this
If " text_auto = True ", I would only get the value count instead of the percentage value.
How can I add both the value count along and the percentage value on the bar chart in plotly express like shown below