Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Chunk transactions into daily batches by cutoff time

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.

Requirements

  • Each row belongs to exactly one day bucket.
  • The cutoff moves the day boundary away from midnight if needed.

Constraints

  • rows: transactions with a time field.
  • cutoff_hour: hour that starts a new business day.
  • Times before cutoff belong to the previous calendar day.

Examples

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

intermediate

Chunk transactions into daily batches by cutoff time

Interview-style drill: Group timestamped transactions into business days using a non-midnight cutoff time.

Chunk transactions into daily batches by cutoff time.