On this page
article
Stream Large CSV
Process large CSV row by row.
Category: csv
Problem
Process large CSV row by row.
Solution
for row in csv.DictReader(f):
process(row) # never load all into memory
Notes
- Adapt variable names and paths to your project
- Add error handling for production use
- See related chapters in the Learning Path