I'm gettin this error:
AttributeError: 'Workbook' object has no attribute 'add_chart'
While running this code (python version 3.7.4):
import re
import pandas as pd
from pandas import ExcelWriter
from pandas import ExcelFile
import numpy
# ... other code here not involved to this part ...
df = pd.DataFrame({"city": city_list, "tourist": tourist_list, "month": month_list})
writer = pd.ExcelWriter('C:\\Users\\portovenere\\Downloads\\exc.xlsx')
workbook = writer.book
chart = workbook.add_chart({'type': 'column'})
chart.add_series({
'totals': '=Sheet1!$A$3:$A$21',
'gap': 2,
})
add_chart
usage is explained in this pandas xlsx-writer documentation that I'm following.
I see add_chart
is defined in XlsxWriter/workbook.py at line 228
def add_chart(self, options):
"""
Create a chart object.
Args:
options: The chart type and subtype options.
Returns:
Reference to a Chart object.
"""
What I'm missing?
Thank you