我如何用几行将几个数据帧(A,B,C等)导出到一个excel文件?
Excel_file = pd.ExcelWriter('Excel_file.xlsx', engine='xlsxwriter')
A.to_excel(A,'A')
B.to_excel(B,'B')
C.to_excel(C,'C')
.
.
.
谢谢
答案 0 :(得分:1)
像这样:
with pd.ExcelWriter('Excel_file.xlsx', engine='xlsxwriter') as Excel_file:
for df, tabname in zip(list_of_dfs, list_of_sheetnames):
df.to_excel(Excel_file, tabname)