Using Pandas and XlsxWriter to create Excel charts

An introduction to the creation of Excel files with charts using Pandas and XlsxWriter.

import pandas as pd


writer = pd.ExcelWriter('farm_data.xlsx', engine='xlsxwriter')
df.to_excel(writer, sheet_name='Sheet1')

workbook =
worksheet = writer.sheets['Sheet1']

chart = workbook.add_chart({'type': 'column'})


The charts in this document are heavily influenced by the output of Vincent a data visualisation tool that is also integrated with Pandas.