Skip to content

Commit 03ea90f

Browse files
committed
DOC: add example for making Excel headers bold using Styler.applymap_index
1 parent 46ed6b1 commit 03ea90f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

doc/source/user_guide/io.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3760,6 +3760,13 @@ The look and feel of Excel worksheets created from pandas can be modified using
37603760
to create styled excel files. For documentation on styling spreadsheets, see
37613761
`here <https://pandas.pydata.org/docs/user_guide/style.html#Export-to-Excel>`__.
37623762

3763+
To make the header row bold when exporting to Excel:
3764+
3765+
.. code-block:: python
3766+
3767+
df.style.applymap_index(lambda v: "font-weight: bold;", axis="columns").to_excel("out.xlsx")
3768+
3769+
For more advanced styling with borders:
37633770

37643771
.. code-block:: python
37653772

0 commit comments

Comments
 (0)