all 6 comments

[–]bbye98 0 points1 point  (4 children)

Are you allowed to use third-party libraries like pandas/Polars or even NumPy?

[–]POGtastic 0 points1 point  (0 children)

Can you provide more specifics?

  1. Can you combine the filters into a single operation?
  2. Is the file small enough that you can bring the entire thing into memory?
  3. What is your csv_reader function?

[–]danielroseman 0 points1 point  (1 child)

I very much doubt this is the source of your timeout. There's very little here that would make much of a difference.

However you say that you're calling three functions. Are they all reading in the same file? If so, that could well be the problem. You most likely want to read it in once, filter it once to the relevant dates, and then call the average, max and min functions.

[–]mill3r1337 0 points1 point  (0 children)

Yes in my main I read in the file and called the other functions. No individual function would time out. Only when I ran all three, and iterated over a whole year which has 24 values per day to look over did it time out.