同事们,我有以下excel文件。但是,当我再次编译程序时,我的数据被覆盖。我想将下一个汇编的每个结果放在一行中。我已经看到一些附加的例子,但我不能让它工作。请有人帮助我吗? !添加行而不覆盖(Python)
writer = pd.ExcelWriter('output.xlsx')
df = pd.DataFrame({'Function':[Output],'Circuit':[gates],'Cost':[cost]},)
df.to_excel(writer,'Sheet1')
writer.save()
追加到其他列或工作表?例如:https://stackoverflow.com/questions/20219254/how-to-write-to-an-existing-excel-file-without-overwriting-data-using-pandas – albert
@albert追加到其他行。 –
可能不是效率最高的,但是您可以将excel文件读入df,将新数据添加到df中,然后将df写入新的excel。 – Yeile