对pandas的dataframe绘图并保存
对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')