Confirmed or Waitlisted Webinar Seats
Problem
You are given two DataFrames. `sessions` (from `sessions.csv`) has columns `session_id` (the primary key) and `seat_limit` (how many confirmed seats the webinar offers). `registrations` (from `registrations.csv`) has columns `attendee_id` (the primary key), `session_id`, and `registered_at` (a datetime); each row is one person registering for one session, and registration times within a session are distinct.
Seats are filled first-come-first-served by `registered_at`. The earliest `seat_limit` registrations of a session are `Confirmed`; everyone after that is `Waitlist`. Return each `attendee_id` and their `seat_status`, ordered by `attendee_id`.
Input data
Example rows — the live problem includes the full dataset.
| session_id | seat_limit |
|---|---|
| 1 | 2 |
| 2 | 1 |
| attendee_id | session_id | registered_at |
|---|---|---|
| 501 | 1 | 2024-05-01 09:00:00 |
| 502 | 1 | 2024-05-01 09:05:00 |
| 503 | 1 | 2024-05-01 09:10:00 |
| 504 | 2 | 2024-05-02 08:00:00 |
| 505 | 2 | 2024-05-02 08:30:00 |
Expected output
Your answer should return 5 rows with the columns attendee_id, seat_status.
Starter code (Pandas (Python))
import pandas as pd
def webinar_seat_status(sessions, registrations) -> pd.DataFrame:
# Your code here
return sessionsSolve this Pandas question free
Write Pandas (Python) and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock