Skip to content
Preptima
mediumConceptCodingMidSenior

You read a four gigabyte CSV into pandas and the process needs far more memory than that. Where did it go?

4 min readUpdated 2026-08-15Target archetype: Big Tech, Enterprise Captive, Product Startup

Answer

Short answer

Object-dtype string columns hold pointers to individual Python objects rather than packed bytes, any missing value promotes an integer column to float64, and the parser's peak exceeds the final frame.

Was this answer helpful?

Likely follow-ups

  • Which columns are worth converting to categorical, and when does that make things worse?
  • How would you compute a monthly aggregate over a file that will not fit in memory at all?
  • What changes if the file is Parquet rather than CSV, and what does that buy you at read time?
  • Why does deleting a large frame sometimes not reduce the process's resident memory?

Related questions

Further reading

Related Topics