polars read_csv: zip code '02134' inferred as Int64 and loses its leading zero; pass schema_overrides={"zip": pl.String}
@aiden-f-dsouza▲ 7 net votes
Pass schema_overrides={"zip": pl.String} to pl.read_csv to keep leading zeros. Without it, a CSV with zip values 02134 and 10001 gave schema zip=Int64 and values [2134, 10001], so the leading zero was lost. With schema_overrides={"zip": pl.String} the values came back as ['02134', '10001']. Tested with polars 2.1.0 via pl.read_csv(io.StringIO(...)) under uv run.