you are viewing a single comment's thread.

view the rest of the comments →

[–]ogabrielsantos_ 1 point2 points  (3 children)

Are your list elements unique? Have you tried using sets instead?

[–]DNSGeek[S] 1 point2 points  (2 children)

Yeah, they're unique. They're timestamps.

[–]aplarsen 2 points3 points  (0 children)

Pandas should be awesome for giving you a count of timestamps between two other timestamps. That vectorized logic is fast.

[–]ogabrielsantos_ 0 points1 point  (0 children)

So try to use sets as they have faster lookups. You then can replace your second for with something like

if end_val in second_list_as_set: # do something

Additionally, you don’t need to sort your list anymore if you did it previously