我使用熊猫以以下方式写入excel文件:
import pandas writer = pandas.ExcelWriter(‘Masterfile.xlsx‘) data_filtered.to_excel(writer, "Main", cols=[‘Diff1‘, ‘Diff2‘]) writer.save()
Masterfile.xlsx
已经包含许多不同的选项卡。但是,它还不包含“ Main”
。
熊猫正确地写到“主要”表,不幸的是,它也删除了所有其他标签。
Python-如何在不覆盖数据的情况下(使用pandas)写入现有的Excel文件?
原文:https://www.cnblogs.com/chuxin001/p/13986430.html