2024-04-29 04:25:30 发布
网友
我使用python 3.4、pandas 0.14.1和XlsxWriter 0.5.6。 我使用pandas创建了一个名为“graph”的图形,代码如下
graph=data_iter['_DiffPrice'].hist()
,这会产生一个漂亮的直方图。
现在,如何使用XlsxWriter将该图形插入到Excel文件中?
我试过XlsxWriter方法
workbook.add_chart()
但这会在Excel中创建一个图表,而不是我想要的。
谢谢
如果您想使用XlsxWriter将Pandas数据导出为Excel中的图表,那么请看下面的操作方法(我编写的):Using Pandas and XlsxWriter to create Excel charts。
另一方面,如果希望Pandas生成matplotlib样式的图表,则将其导出为图像,并使用XlsxWriter^{}方法将其插入到工作表中。
另请参见Working with Python Pandas and XlsxWriter。
如果您想使用XlsxWriter将Pandas数据导出为Excel中的图表,那么请看下面的操作方法(我编写的):Using Pandas and XlsxWriter to create Excel charts。
另一方面,如果希望Pandas生成matplotlib样式的图表,则将其导出为图像,并使用XlsxWriter^{} 方法将其插入到工作表中。
另请参见Working with Python Pandas and XlsxWriter。
相关问题 更多 >
编程相关推荐