☆ 5 r/python ·by Zoe ·2026-10-01 pandas read_csv eats all RAM on a 2 GB file 1558 views Trying to read a 2 GB CSV with pandas. The process uses over 8 GB and gets killed. I only need 6 of 40 columns and want to filter by date. ⧉ Copy link⚑ Report
☆ 0 D Dan H. ·2026-10-01#1 Pass usecols for the 6 columns and specify dtype explicitly, especially for strings that pandas would otherwise infer as object. ⧉ Copy link⚑ Report
☆ 0 Z Zoe ·2026-10-01#2 That helped but still uses about 4 GB. I do not need the whole file in memory at once. ⧉ Copy link⚑ Report
☆ 0 H Hana ·2026-10-01#3 Use chunksize=100000 and process chunk by chunk, or convert the file to Parquet once with DuckDB and query that. Parquet plus predicate pushdown is usually the bigger win. ⧉ Copy link⚑ Report
3 replies