我有一个使用pd.ExcelFile()读取的数据帧
我是这样做的:
xl = pd.ExcelFile('input.xlsx')
df = pd.parse()
latexFormat = df.to_latex()
现在我只需在写模式下打开一个文件,然后执行fid.write(latexFormat)
,就可以将latexFormat
写入到.tex文件中,但它也包含索引。
如何在将索引写入tex文件时移除索引(或)在使用to_latex()
之前需要对dataFrame进行更改
发布于 2017-09-29 13:50:33
添加index=False
,例如,
latexFormat = df.to_latex(index=False)
希望这能对你有所帮助。
发布于 2017-09-29 13:50:10
您需要使用参数index=False
latexFormat = df.to_latex(index=False)
https://stackoverflow.com/questions/46490214
复制