我试图添加一个自定义的页眉和页脚到一个数据框的excel输出使用熊猫。你知道吗
我的代码:
header = 'File|000|123|45'
footer = df.count()
with open(file_name, 'a') as f:
f.write(header)
df.to_excel(f, header=False, index=False)
f.write(footer)
这给了我一个错误,说明“无法对关闭的文件执行I/O操作。你知道吗
在将df保存为excel时,是否有其他方法添加页眉和页脚。当我将它保存为CSV时,它工作得非常好。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐