I have a bunch of events with their occurrence date in milliseconds (Epoch). I need to put these events in buckets based on the week of the year. I only need a count of the incidents in a given week. For instance:
2021:
week 1 - 5 incidents
week 2 - 10 incidents
Questions I have is:
What is the easiest data structure to store this? Would it be a list of tuples? For instance:
2021_weeks_list = [] 2021_weeks_list[0] = ('w1',5) 2021_weeks_list[1] = ('w2',10)
Or is there another data structure that would suit this more?
- How do I get the week of a date? For instance 1612805820000 is "Monday, February 8, 2021 9:37:00 AM" and that would be week 7 of 2021. I am not sure if there is a Python library that will return a week when given a date.