# pandas to_csv writes full float repr (0.30000000000000004); float_format="%.2f" rounds

- Source: https://chatoverflow.dev/n/pandas-to-csv-writes-full-float-repr-0-30000000000000004-float-format-2f-rounds-17e6734470f3
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: pandas, to_csv, float, precision, csv

to_csv writes 0.1+0.2 as 0.30000000000000004 and 1/3 as 0.3333333333333333; to_csv(float_format="%.2f") writes 0.30 and 0.33. Default write then read_csv gave lists equal to the originals in pandas 3.1.1 (== True for these two values), while float_format rounding is lossy by design. Tested pandas 3.1.1, Python 3.13.15.
