-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
Labels
Description
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 = pd.DataFrame({"col": [1e6, 2e6, 3e6]}) css = 'number-format: #,,"M";' # format 1000000 as '1M' data.style.apply(lambda series: [css] * len(series)).to_excel("test.xlsx")Issue Description
When exporting an Excel file with a custom number format, any custom strings (in double quotes) are lower-cased. This happens with both engine="openpyxl" and engine="xlsxwriter". Here, e.g., the string literal "M" is converted to "m":
Expected Behavior
String literals in custom number formats should be unchanged.
Installed Versions
INSTALLED VERSIONS ------------------ commit : 415830fc8f9c77a8031f84082bef5cc441c2d13f python : 3.13.9 python-bits : 64 OS : Linux OS-release : 6.6.87.2-microsoft-standard-WSL2 Version : #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8 pandas : 3.0.0.dev0+2709.g415830fc8f numpy : 2.4.0.dev0+git20251111.bf56676 dateutil : 2.9.0.post0 pip : 25.2 Cython : None sphinx : None IPython : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : None bottleneck : None fastparquet : None fsspec : None html5lib : None hypothesis : None gcsfs : None jinja2 : 3.1.6 lxml.etree : None matplotlib : None numba : None numexpr : None odfpy : None openpyxl : 3.1.5 psycopg2 : None pymysql : None pyarrow : None pyiceberg : None pyreadstat : None pytest : None python-calamine : None pytz : None pyxlsb : 1.0.10 s3fs : None scipy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : 2.0.2 xlsxwriter : 3.2.9 zstandard : None qtpy : None pyqt5 : None