I can't figure out what would be an appropriate data structure for my problem. I need to write a script that will count some events. Input is a list of events (thousands of them). Each event is an object with following attributes:
class Event
company
city
office
department
You can look at it like this: „Each event is related to one company in a particular town in one office and in one department of that office“.
My script needs to output the total number of events for company, town office and department. Basically it needs to output sentences like this:
Total events in company X in town Y in office Z in department T : 15
Total events in company X in town Y in office Z in department R: 36
...
Total events in company N in town Y in office G in department T: 89
...
How should I store these counts and how should I count them. I was thinking of using nested dictionaries (in python) or in-memory SQL database. Is there any other way?