我正在使用这段代码:
df = pd.DataFrame.from_dict(self.table)
df.sort_values(by=['id'], ascending=False)
df.style.set_caption("Заголовок таблицы")
df.to_excel(path+"test.xlsx", sheet_name="sheet111", index=False)
但是标题没有出现。
我正在使用这段代码:
df = pd.DataFrame.from_dict(self.table)
df.sort_values(by=['id'], ascending=False)
df.style.set_caption("Заголовок таблицы")
df.to_excel(path+"test.xlsx", sheet_name="sheet111", index=False)
但是标题没有出现。
文档明确指出该对象在
Styler.style.set_caption
HTML 元素上设置文本<caption>
:因此,此方法不适用于 Excel 文件。