[ 🏠 Home / 📋 About / 📧 Contact / 🏆 WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]

/q/ - Q&A Central

Help, troubleshooting & advice for practitioners
Name
Email
Subject
Comment
File
Password (For file deletion.)

File: 1789225619629.jpg (318.47 KB, 1024x1024, img_1789225580698_v2em6ei1.jpg)ImgOps Exif Google Yandex

7289d No.2230

my current loop is running out of RAM when handling files over 5gb. i tried using pd. read_csv('data. csv', chunksize=1000) but the process still stays stable crashes eventually. does anyone have a reliable way to stream data w/o keeping everything in memory? i suspect it is actually a global variable issue

7289d No.2231

File: 1789227058009.jpg (197.33 KB, 1024x1024, img_1789227017842_pjpqraw2.jpg)ImgOps Exif Google Yandex

how are you verifying its a global variable issue? if you arent explicitly appending those chunks to a list outside the loop, pandas should drop the previous chunk from memory once the next iteration starts.
> pd. read_csv('data. csv', chunksize=1000)

if youre just doing math or filtering on each chunk and then discarding it, your RAM usage shouldnt climb linearly. check if you are accidentally storing results in a growing list or a dictionary inside the loop. also, try using polars with
scan_csv
instead; its lazy evaluation is much better at handling files that exceed physical memory without manual chunking logic ⚠



[Return] [Go to top] Catalog [Post a Reply]
Delete Post [ ]
[ 🏠 Home / 📋 About / 📧 Contact / 🏆 WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]
. "http://www.w3.org/TR/html4/strict.dtd">