0
我有6個數據框(名爲a
到f
),我想導入到ms.excel,爲了使這更容易閱讀我想給每個數據框標籤,我嘗試工作with cell notation,但我得到的錯誤mesage,這裏是我的代碼:給熊貓數據框標題導出爲excel
writer = pd.ExcelWriter('Summary Data Request 8 weeks.xlsx')
a.to_excel(writer, sheet_name='Sheet1', startrow=1)
b.to_excel(writer, sheet_name='Sheet1', startcol=7)
c.to_excel(writer, sheet_name='Sheet1', startrow=11)
d.to_excel(writer, sheet_name='Sheet1', startrow=11, startcol=6)
e.to_excel(writer, sheet_name='Sheet1', startrow=21)
f.to_excel(writer, sheet_name='Sheet1', startrow=21, startcol=6)
writer.write('A1', 'Retail Kelontong')
writer.write('G1', 'Pulsa')
writer.write('A11', 'Minimarket')
writer.write('G11', 'Retail dengan barcode')
writer.write('A21', 'Retail dengan barcode 2')
writer.write('G21', 'Food and Beverage')
writer.save()
這裏的錯誤消息:
AttributeError Traceback (most recent call last)
<ipython-input-30-2354b95670c9> in <module>()
6 e.to_excel(writer, sheet_name='Sheet1', startrow=21)
7 f.to_excel(writer, sheet_name='Sheet1', startrow=21, startcol=6)
----> 8 writer.write('A1', 'Retail Kelontong')
9 writer.write('G1', 'Pulsa')
10 writer.write('A11', 'Minimarket')
AttributeError: '_XlsxWriter' object has no attribute 'write'
我仍然不知道我做錯了什麼,我試圖改變作家Sheet1
和錯誤消息是
name 'Sheet1' is not defined
我沒有想法什麼嘗試
謝謝,這就是作品 –