DataFrame如何保存成图片
import dataframe_image as dfi dfi.export(pInfo2, './myplot6.png')#可以非常漂亮
以下的方案请放弃、
pInfo2 = pInfo.iloc[:,1:pInfo.shape[1]-1]#排除掉销售额,曲线看起来非常不直观 ax = pInfo2.plot() plt.show() fig = pInfo.get_figure() fig.savefig('./myplot6.png')
#把dataFrame保存成一张图片,看不清,放弃这种方案 plt.close('all') from pandas.plotting import table fig = plt.figure(figsize=(3, 4), dpi=1400)#dpi表示清晰度 ax = fig.add_subplot(111, frame_on=False) ax.xaxis.set_visible(False) # hide the x axis ax.yaxis.set_visible(False) # hide the y axis table(ax, pInfo, loc='center') plt.savefig('./myplot6.jpg')#表格