我有这个excel文件:
Sentence
12 rue magnol à montpellier
5 avenue de la chantroune 38190 villard bonnot
这个代码是:
import pandas as pd
excel = pd.read_excel(open('Data.xlsx','rb'), sheetname='Data', index=False)
print(excel)
第一行成为列名,所以一切都很好,但当我打印时,excel文件中索引的列似乎进入了我的数据框,我就是无法驾驭它:
Sentence \
0 12 rue magnol à montpellier
1 5 avenue de la chantroune 38190 villard bonnot
你知道吗
没有索引就不能有数据帧
但是,excel.values将提供没有索引的原始数组
例如,当写回csv时,可以将index=False,这样就不会将索引写回文件
相关问题 更多 >
编程相关推荐