How to drop index column using panda while writing?

Question:

df.columns = pd.MultiIndex.from_tuples(
    zip(['AA ', 'BB ', '','DD', 'EE',''],df.columns))

I used the above code in my script that’s why I have to set index=True

df.to_excel(arg,index=True)

But now I want to drop my index column
What can I Do?

I Tried : df.reset_index(inplace=True) data.reset_index(drop=True, inplace=True) df.drop() But no one is worked..!

Asked By: Amol_G

||

Answers:

Did you try setting index to ‘False’ while exporting to excel ?

df.to_excel(arg,index=False)
Answered By: Khaled DELLAL

To drop the index column, use this:

df = df.reset_index(drop=True)
Answered By: Ashutosh Yadav
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.