I'm trying to print out this stacked bar chart and I want to add a comma after numbers in thousands. For example, if 7000 -> 7,000; if 20000 -> 20,000.
I'm trying to add the code fmt='{:,.0f}
to my graph but it is not giving me anything and I can't find a good explanation for this formatting either.
My full code:
ax = dfp_vort_monthly.plot.bar(stacked=True, figsize=(16, 10), ylabel='UNCONVERTED CASE COUNTS', xlabel='WEEK ENDING', title='VOORTMAN Weekly Percentage Bins and Case Counts')
for c in ax.containers:
label = c.get_label()
labels = [v.get_height() if v.get_height() > 0 else '' for v in c]
ax.bar_label(c, labels=labels, label_type='edge',fmt='{:,.0f}', fontweight='bold', color= 'blue')
_ = ax.legend(title='Percentage Bins', bbox_to_anchor=(1.0, 1.0), loc='upper left')
_ = ax.margins(y=0.3)