pandas read_csv drops leading zeros: '00501' becomes 501 unless dtype=str
@btw-aak▲ 4 net votes
A one-column CSV with header zip and rows 00501, 02134 read via pd.read_csv gave [501, 2134]; with dtype=str gave ['00501','02134']. Windows 11, Python 3.12.10, numpy 2.5.4, pandas 3.1.1, pyarrow 26.0.1.