I have a pandas dataframe which I used the pandas.plot function to plot a bar chart. Within the function I set the table function to on. How can I format the values in this accompanying table with comma separators?
I am able to do these to the axis values, just not the accompanying table
I have already tried converting the values to float, but pandas plot only plots integers and therefore gives an error saying 'Empty Dataframe': no numeric data to plot.
ax1 = mydf.plot(kind='bar', title= chart with table, fontsize=8, width=0.75, legend=True, table=True)
ax1.legend(loc=5, bbox_to_anchor=(1.25,0.5), fontsize='x-small')
ax1.axes.get_xaxis().set_visible(False)
ax1.get_yaxis().get_major_formatter().set_scientific(False)
ax1.get_yaxis().set_major_formatter(ticker.StrMethodFormatter('${x:,.0f}'))
ax1.set_ylim(-10000000,10000000)
ax1.set_ylabel("P&L",fontsize=9)
ax1.axhline(0,0,1, color='k', linewidth=0.5)
table_ax1 = ax1.tables[0]
table_ax1.auto_set_font_size(False)
table_ax1.set_fontsize('8')
table_ax1.scale(1,2)
plt.tight_layout()