首页 > 解决方案 > python pandas读取数据框并且不包含索引

问题描述

很简单的问题

我正在用 python 阅读一个 excel 表,我想在没有自动索引 pandas 添加的情况下打印结果

import pandas as pd

x=pd.read_excel(r'2_56_01.276295.xlsx',index_col=None)
print x[:3]

这打印第一 3 行

   blahblah           Street Borough
0        55         W 192 ST   Bronx
1      2514  EAST TREMONT AV   Bronx
2       877     INTERVALE AV   Bronx

但我不想要索引

标签: pythonpandas

解决方案


print x.to_string(index=False)

应该做的伎俩


推荐阅读