1. 程式人生 > >對pandas的dataframe繪圖並保存

對pandas的dataframe繪圖並保存

class span 並保存 itl style title 取值 figure nbsp

對dataframe繪圖並保存:

ax = df.plot() 
fig = ax.get_figure()
fig.savefig(fig.png)

可以制定列,對該列各取值作統計:

label_dis = df.label.value_counts()
ax = label_dis.plot(title=label distribution, kind=bar, figsize=(18, 12))
fig = ax.get_figure()
fig.savefig(label_distribution.png)

對pandas的dataframe繪圖並保存