Skip to content

Conversation

@antznette1
Copy link

@rhshadrach

This PR adds a documentation example showing how to make Excel header rows bold when
exporting DataFrames using Styler.applymap_index().

This addresses a common use case mentioned in issue #62651 where users want
to bold header rows in Excel exports. The example demonstrates the recommended
approach using Styler rather than modifying to_excel() directly.

Example:

df.style.applymap_index(lambda v: "font-weight: bold;", axis="columns").to_excel("out.xlsx")

Related to #62651

@antznette1
Copy link
Author

Hi @rhshadrach, I hope you’re doing well.
When you get a chance, could you please review my PR? I’d really appreciate your feedback so we can move it forward.
Thanks a lot!

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Currently the user guide has all docs on the styler in styler.ipynb, and where there is an operation like to_excel that is relevant to the styler, we link instead of spreading out or duplicating the documentation. I think we should stick to this pattern.

The documentation being added here also seems duplicate the documentation here:

https://pandas.pydata.org/pandas-docs/dev/user_guide/style.html#Acting-on-the-Index-and-Column-Headers

applymap_index is not mentioned because it has been removed.

@rhshadrach rhshadrach added Docs Styler conditional formatting using DataFrame.style labels Nov 1, 2025
@antznette1
Copy link
Author

antznette1 commented Nov 2, 2025

Thanks for the PR. Currently the user guide has all docs on the styler in styler.ipynb, and where there is an operation like to_excel that is relevant to the styler, we link instead of spreading out or duplicating the documentation. I think we should stick to this pattern.

The documentation being added here also seems duplicate the documentation here:

https://pandas.pydata.org/pandas-docs/dev/user_guide/style.html#Acting-on-the-Index-and-Column-Headers

applymap_index is not mentioned because it has been removed.

Thank you for the feedback.
I see the functionality is already documented in io.rst (with an example using font-weight: bold) and links to the styler documentation. I also missed that applymap_index has been removed.
I’ll close this PR. Apologies for the oversight.

@antznette1 antznette1 closed this Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Docs Styler conditional formatting using DataFrame.style

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants