I have the following data set(df):
``source_city class price
0 Bangalore Business 53671.856898
1 Bangalore Economy 6526.294410
2 Chennai Business 54036.749819
3 Chennai Economy 6497.568622
4 Delhi Business 48614.172893
5 Delhi Economy 6275.093136
6 Hyderabad Business 50357.590531
7 Hyderabad Economy 6207.890037
8 Kolkata Business 56401.673678
9 Kolkata Economy 7410.881850
10 Mumbai Business 52666.702876
11 Mumbai Economy 6334.098781
“
I want to plot bar graph using python seaborn library:
I tried it like the following
bar_plot = sns.barplot(x = 'source_city', y = 'price', hue = 'class', data = df)
Fetching bar labels
for labels in bar_plot.containers: bar_plot.bar_label(labels)
But in place of the values(price) I want the percentage(price) as bar label
How to do that, please guide.
Can I use estimator parameter, If so, how?
Victor Banerjee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.