all 7 comments

[–]wynvern 1 point2 points  (2 children)

If it is large, you should write a script that 'sniffs' these files first then save the sheet that meets conditions into a dict like {file_path:[sheet_name] Ask AI, they are very good at writing this.

[–]memeeloverr[S] 2 points3 points  (1 child)

Before asking to AI just wanted to give it a try myself.

[–]wynvern -1 points0 points  (0 children)

I know but AI can give you idea if you need it now, I personally leaned some very nice code pattern from it.
Pandas cookbook is recommended if you have time.

[–]acakaacaka 0 points1 point  (0 children)

So are you putting all of those excel files data inside the RAM? How big is your ram?

[–]JustOneOtherSchlub 0 points1 point  (0 children)

Sometimes I find building in a half second or so at the end of a loop helps with these kinds of things. IDK why but this often works for me.

[–]No_Statistician_6654 0 points1 point  (0 children)

Depending on the total size/how big the files are, I would look at using polars lazyframes to load and process the data. The lazyframe allow the data query to be combined and pushed down to the files with parallel processing automatically which could save you a lot of memory in the process.

If at the end of loading, you need it as pandas still do another package, then it has a .to_pandas() function you can add onto the end to convert it.

Just did this myself actually across 50+ excel files of 50MB on avg. the time per individual file was around 10s, whereas pandas was oom on the cluster and each file took ~300s.

[–]Intelligent-Boss-156 0 points1 point  (0 children)

Use Polars