File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -3912,15 +3912,15 @@ The look and feel of Excel worksheets created from pandas can be modified using
3912
3912
3913
3913
As of Pandas 3.0, by default spreadsheets created with the ``to_excel `` method
3914
3914
will not contain any styling. Users wishing to bold text, add bordered styles,
3915
- etc in a worksheet output by ``to_excel `` can do so by using ``Styler.to_excel ``
3916
- to create styled excel files.
3915
+ etc in a worksheet output by ``to_excel `` can do so by using :meth: `Styler.to_excel `
3916
+ to create styled excel files. For documentation on styling spreadsheets, see
3917
+ `here <https://pandas.pydata.org/docs/user_guide/style.html#Export-to-Excel >`__.
3917
3918
3918
3919
3919
3920
.. code-block :: python
3920
3921
3921
- css = " border: 1pt solid #111222"
3922
- styler = df.style.map(lambda x : css)
3923
- styler.to_excel(" path_to_file.xlsx" , sheet_name = " custom" , index = False )
3922
+ css = " border: 1px solid black; font-weight: bold;"
3923
+ df.style.map_index(lambda x : css).map_index(lambda x : css, axis = 1 ).to_excel(" myfile.xlsx" )
3924
3924
3925
3925
Using the `Xlsxwriter `_ engine provides many options for controlling the
3926
3926
format of an Excel worksheet created with the ``to_excel `` method. Excellent examples can be found in the
You can’t perform that action at this time.
0 commit comments