我遇到了這個錯誤:AttributeError: 'Workbook' object has no attribute 'add_chart'運行此代碼時(python 版本 3.7.4):import reimport pandas as pdfrom pandas import ExcelWriterfrom pandas import ExcelFileimport 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.bookchart = workbook.add_chart({'type': 'column'})chart.add_series({ 'totals': '=Sheet1!$A$3:$A$21', 'gap': 2,})add_chart我正在關注的這個pandas xlsx-writer 文檔中解釋了用法。我看到add_chart在XlsxWriter/workbook.py第 228 行定義def add_chart(self, options): """ Create a chart object. Args: options: The chart type and subtype options. Returns: Reference to a Chart object. """我錯過了什么?
添加回答
舉報
0/150
提交
取消