import matplotlib.pyplot as plt
from pandas.plotting import table
desc = df['Revenue'].describe()
#create a subplot without frame
plot = plt.subplot(111, frame_on=False)
#remove axis
plot.xaxis.set_visible(False)
plot.yaxis.set_visible(False)
#create the table plot and position it in the upper left corner
table(plot, desc,loc='upper right')
#save the plot as a png file
plt.savefig('desc_plot.png')
另存为csv或xlsx文件
您可以使用to_csv(“filename.csv”)或to_excel(“filename.xlsx”)方法以逗号分隔的格式保存文件,然后根据需要在excel中操作/格式化文件。 示例:
另存为png文件
正如注释中提到的,thispost解释了如何通过matplot lib将pandas数据帧保存到png文件。在您的情况下,这应该有效:
相关问题 更多 >
编程相关推荐