The Event Bucketer
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- L5
Problem
Given log tuples [timestamp_string, event_label] where timestamp is 'YYYY-MM-DD HH:MM:SS', bucket by hour using the first 13 characters ('YYYY-MM-DD HH'). Return a dict mapping each hour bucket to a dict mapping each event label to its count within that hour.
Summary
Logs slotted into buckets.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.