我有一个脚本可以输出 Pandas 数据框,并保存到笔记本中。然而,这些表格并不专业,我想知道在 Pandas/Excel 写入模块中是否有一种方法可以为我的列添加列标题、图例、合并单元格、添加标题等功能。
下面是 Python 生成的 Pandas 数据框:
下面是 Python 生成的 Pandas 数据框:
![enter image description here](https://istack.dev59.com/Z5kiy.webp)
excel_df=pd.DataFrame(closeended_all_counts).T
excel_df.columns=all_columns
writer=pd.ExcelWriter('L:\OMIZ\March_2018.xlsx',engine='xlsxwriter')
excel_df.to_excel(writer,'Final Tables')
workbook = writer.book
worksheet = writer.sheets['Final Tables']
writer.save()
我需要的输出结果如下:
有任何文档或模块都将非常棒!