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

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

问题描述

我正在尝试将熊猫中的数据框打印到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.html http ://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天全站免登陆