簡體   English   中英

使用XlsxWriter將pandas圖表插入Excel文件

[英]Insert pandas chart into an Excel file using XlsxWriter

我使用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中的圖表,請查看以下操作方法(我寫的): 使用Pandas和XlsxWriter創建Excel圖表

在此輸入圖像描述

另一方面,如果您想要Pandas生成的matplotlib樣式圖表,則將它們導出為圖像,並使用XlsxWriter insert_image()方法將它們插入到工作表中。

另請參閱使用Python Pandas和XlsxWriter

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM