Reputation: 3964
I have this excel file:
Sentence
12 rue magnol à montpellier
5 avenue de la chantroune 38190 villard bonnot
And this code:
import pandas as pd
excel = pd.read_excel(open('Data.xlsx','rb'), sheetname='Data', index=False)
print(excel)
The first row becomes the columns names, so everything is good but, when I print, the column of the index in my excel file seems to get into my dataframe and I just can't get ride of it:
Sentence \
0 12 rue magnol à montpellier
1 5 avenue de la chantroune 38190 villard bonnot
Any idea?
Upvotes: 0
Views: 39
Reputation: 1670
You can't have a DataFrame without the indexes.
However, excel.values will give you the raw NumPy ndarray without the indexes.
When writing back to a csv for instance, you can set index=False so that no index is written back to the file.
Upvotes: 2