Insert pandas chart into Excel file using XlsxWriter

I am using python 3.4, pandas 0.14.1 and XlsxWriter 0.5.6. I am creating a graph called "graph" using pandas with the following code

graph=data_iter['_DiffPrice'].hist() 

which creates a beautiful histogram.

Now, how can I insert this graph into an Excel file using XlsxWriter?

I tried the XlsxWriter method

 workbook.add_chart() 

but this creates a graph in Excel, and not what I want.

thanks

+7
python pandas xlsxwriter
source share
1 answer

If you want to export Pandas data as charts to Excel using XlsxWriter, then look at the following guide (which I wrote): Using Pandas and XlsxWriter to create Excel charts .

enter image description here

If, on the other hand, you need matplotlib-style charts generated using Pandas, then export them as images and paste them into the worksheet using XlsxWriter insert_image() .

See also Working with Python Pandas and XlsxWriter .

+13
source share

All Articles