pandas 数据框隐藏索引功能? [英] Pandas dataframe hide index functionality?
本文介绍了 pandas 数据框隐藏索引功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
显示大熊猫数据框时是否可以隐藏索引,以便仅列名出现在表的顶部?
Is it possible to hide the index when displaying pandas dataframes, so that only the column names appear at the top of the table?
这将需要同时适用于ipython笔记本中的html表示形式和to_latex()函数(我正在与nbconvert一起使用).
This would need to work for both the html representation in ipython notebook and to_latex() function (which I'm using with nbconvert).
Ta.
推荐答案
设置index=False
对于ipython笔记本:
For ipython notebook:
print df.to_string(index=False)
对于to_latex:
For to_latex:
df.to_latex(index=False)
这篇关于 pandas 数据框隐藏索引功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文