Pandas 的read_excel()方法在调用 with 时sheet_name=None
将返回每个 Excel 表的字典。如何反转此操作,即使用字典并保存多页excel文件?我只看到了一种通过to_excel()方法将单个日期框保存到 excel 的方法。
我会说通常这个操作是使用执行的pandas.ExcelWriter
(假设 df_dict 是你的 DataFrames 字典):
import pandas as pd
with pd.ExcelWriter('path/to/save/table.xlsx') as writer:
for key, df in df_dict.items():
df.to_excel(writer, key)
writer.save()
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句