Skip to content

BUG: df.to_excel() makes some default formatting #50991

Closed
@Franky1

Description

@Franky1

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
data = {'col_1': [3, 2, 1, 0], 'col_2': ['a', 'b', 'c', 'd']}
df = pd.DataFrame.from_dict(data)
df.to_excel('bug.xlsx', index=True)

# have a look at the generated bug.xlsx file

Issue Description

Not really a bug, but a bit unexpected:
The index column and the header row is formatted in bold and with thin frame lines around.
The rest of the table data is not formatted.

Expected Behavior

I would expect no formatting at all, unless specified.
But maybe this behaviour is intended?

Installed Versions

INSTALLED VERSIONS

commit : 2e218d1
python : 3.9.10.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19045
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
byteorder : little
LC_ALL : None
LANG : de_DE.UTF-8
LOCALE : de_DE.cp1252

pandas : 1.5.3
numpy : 1.24.1
pytz : 2022.7.1
dateutil : 2.8.2
setuptools : 64.0.2
pip : 22.3.1
Cython : None
pytest : None
hypothesis : None
...
xlrd : None
xlwt : None
zstandard : None
tzdata : 2022.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageIssue that has not been reviewed by a pandas team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions