yoshiserry
yoshiserry

Reputation: 21345

how do you remove the index from a dataframe before using xlwriter to convert the dataframe to a excel file

Love using pandas to manipulate data but I am having some trouble.

Whenever I output a dataframe as a file, the index remains. I would like to remove it, and have the first column in column A of the excel spreadsheet.

Upvotes: 1

Views: 72

Answers (1)

joris
joris

Reputation: 139132

Set the index keyword argument to False:

df.to_excel( ..., index=False)

See the docs of to_excel for all arguments: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_excel.html

Upvotes: 4

Related Questions