Zero-Filled Fifteen-Minute Comment Counts for Instagram Live in Pandas

Last updated: November 29, 2026

Quick Overview

Given Instagram Live broadcasts with start and end times and a table of their comments, produce comment counts per broadcast in 15-minute buckets covering the whole broadcast, including buckets with zero comments. Comments outside a broadcast's window are dropped.

Meta
Data Manipulation (SQL/Python)
Data Scientist
Meta
November 29, 2026
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Given Instagram Live broadcasts with start and end times and a table of their comments, produce comment counts per broadcast in 15-minute buckets covering the whole broadcast, including buckets with zero comments. Comments outside a broadcast's window are dropped.

A pandas exercise in Meta data science screens, framed around the Live insights panel that shows creators when their audience was most engaged. The interviewer checks time flooring, reindexing to a complete grid, and handling of per-entity time ranges.

What the Interviewer Expects
  • Join comments to broadcast windows and filter
  • Floor timestamps to 15-minute buckets
  • Group and count per broadcast and bucket
  • Reindex each broadcast to its full bucket grid with zeros
  • Get the bucket range boundaries right
Key Topics to Cover
pandas
floor and resample
reindex
zero filling
time buckets
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you do this with resample instead of reindex?
  • How would you scale this to millions of broadcasts?
  • Should buckets align to the clock or to the broadcast start?
  • How would you normalize by concurrent viewers?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

comments(live_id, ts) and lives(live_id, start_ts, end_ts), timestamps as pandas Timestamps in UTC. Windows are half-open [start, end). Buckets align to the clock (10:00, 10:15), which is what t...

Approach

Merge comments to their broadcast, drop rows outside the window, floor ts to 15 minutes and count with groupby(...).size(). Counts alone miss empty buckets, so for each broadcast I build the grid ...


Submit Your Answer
Markdown supported