Python data engineering interview problem. Difficulty: intermediate. Pattern: Date Functions. About 15 minutes. Part of the Pro drill bank.
Transactions have timestamps. Finance wants them bucketed into days using a cutoff hour so a 1am sale still belongs to the previous business day if the cutoff is 4am.
Chunk transactions into daily batches by cutoff time.
Input: bucket_by_cutoff([{'ts': '2026-08-10T09:00:00', 'id': 'a'}, {'ts': '2026-08-10T03:00:00', 'id': 'b'}], 6) Output: {'2026-08-10': ['a'], '2026-08-09': ['b']} This input follows the stated rules and produces this output.
Topics: lakebench, python, data-transformation.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Group timestamped transactions into business days using a non-midnight cutoff time.
Chunk transactions into daily batches by cutoff time.