out_file = ‘query.xlsx’
df1 = pd.DataFrame(out_data)
若直接写入:
df1.to_excel(out_file, index=False, sheet_name=‘v5v7’)
# 将第二个DataFrame保存到现有的Excel文件的新工作表
with pd.ExcelWriter(out_file, engine=‘openpyxl’, mode=‘a’) as writer:
df1.to_excel(writer, sheet_name=‘v5v7’, index=False)
# # 将第二个DataFrame保存到现有的Excel文件的新工作表
with pd.ExcelWriter(out_file, engine='openpyxl', mode='a') as writer:df1.to_excel(writer, sheet_name='v5v7', index=False)