没有行名(索引)从 pandas 导出到_excel? [英] Export from pandas to_excel without row names (index)?

查看:31
本文介绍了没有行名(索引)从 pandas 导出到_excel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 Pandas 中的数据框打印到 Excel 中.这里我使用的是 to_excel() 函数.但是,我发现Excel中的第一列是索引",

I'm trying to print out a dataframe from pandas into Excel. Here I am using to_excel() functions. However, I found that the 1st column in Excel is the "index",

0   6/6/2021 0:00   8/6/2021 0:00
1   4/10/2024 0:00  6/10/2024 0:00
2   4/14/2024 0:00  6/14/2024 0:00

有没有办法去掉第一列?

Is there any ways to get rid of the first column?

推荐答案

to_excel 需要设置index=False 才能不写入索引列出来,这个语义在其他 Pandas IO 工具中被遵循,参见 http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_excel.htmlhttp://pandas.pydata.org/pandas-docs/stable/io.html

You need to set index=False in to_excel in order for it to not write the index column out, this semantic is followed in other Pandas IO tools, see http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_excel.html and http://pandas.pydata.org/pandas-docs/stable/io.html

这篇关于没有行名(索引)从 pandas 导出到_excel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆