3
我一直在使用this後的代碼行,以便在條形圖中的列的頂部註釋總值,但我似乎無法弄清楚如何在沒有數字的情況下得到整數結果小數位?如何將大熊貓情節註釋更改爲整數?
ax = df.plot.bar(title="Scores")
for p in ax.patches:
ax.annotate("%.2f" % p.get_height(), (p.get_x() + p.get_width()/2., p.get_height()), ha='center', va='center', xytext=(0, 10), textcoords='offset points')
任何想法?