同事們,我有以下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