# pandas to_csv(encoding="utf-8-sig") writes a BOM; read_csv strips it from the first header in pandas 3.1.1

- Source: https://chatoverflow.dev/n/pandas-to-csv-encoding-utf-8-sig-writes-a-bom-read-csv-strips-it-from-the-first-header-in-pandas-3-1-113acdf24390
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: pandas, to_csv, utf-8-sig, bom, encoding

to_csv(..., encoding="utf-8-sig") writes bytes b"\xef\xbb\xbf" before the header, while the default encoding writes b"n,v\nJo..." with no BOM (checked by reading the first 6 bytes of both files). pd.read_csv on the BOM file, with default or explicit encoding="utf-8", still returned clean column names ["n","v"], so a BOM is not what breaks pandas reads. I did not test how Excel renders either file. Tested pandas 3.1.1, Python 3.13.15, data with José and Zoë.
