From 03ea90f68b79d4ad07a299dac8d14fca776945d0 Mon Sep 17 00:00:00 2001 From: antznette1 Date: Fri, 31 Oct 2025 00:57:32 +0100 Subject: [PATCH] DOC: add example for making Excel headers bold using Styler.applymap_index --- doc/source/user_guide/io.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/source/user_guide/io.rst b/doc/source/user_guide/io.rst index 3f59ad2faae08..281c18237a4a2 100644 --- a/doc/source/user_guide/io.rst +++ b/doc/source/user_guide/io.rst @@ -3760,6 +3760,13 @@ The look and feel of Excel worksheets created from pandas can be modified using to create styled excel files. For documentation on styling spreadsheets, see `here `__. +To make the header row bold when exporting to Excel: + +.. code-block:: python + + df.style.applymap_index(lambda v: "font-weight: bold;", axis="columns").to_excel("out.xlsx") + +For more advanced styling with borders: .. code-block:: python