我想在Excel中打印出一个数据框。我使用ExcelWriter如下:将数据框写入excel以标题
writer = pd.ExcelWriter('test.xlsx')
df = DataFrame(C,ind) # C is the matrix and ind is the list of corresponding indices
df.to_excel(writer, startcol = 0, startrow = 5)
writer.save()
这会产生什么,我需要,但除此之外,我想在桌子上(startcol=0
,startrow=0
)的顶部添加标题一些文字(解释)的数据。
如何使用ExcelWriter添加字符串标题?
感谢百万法比奥。我试图使用write_string,但得到了一些错误的错误实现。现在它完美地工作。 – Hamed