3

I have a dataframe as below, with date as Index

Date           Count
01/01/2020       10
02/01/2020       14
03/01/2020        7

When writing the dataframe to excel, the index is always in bold. how do I remove the bold formatting on the index?

3
  • What do you mean by "removing the bold formatting"? It isn't obvious to me what you mean. Commented Nov 17, 2020 at 5:38
  • 1
    I mean when it's written to an excel file, the index in a dataframe is always bold. I'm wondering if it's possible to have it without the bold formatting Commented Nov 17, 2020 at 10:17
  • 1
    How working df.reset_index().to_excel(file, index=False) ? Commented Nov 17, 2020 at 10:19

1 Answer 1

4

You can use trick - convert index to column and then not write index to file like:

df.reset_index().to_excel(file, index=False)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.