AnalystPath

Confirmed or Waitlisted Webinar Seats

PandasHardSenior level~10 min

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.

sessions
session_idseat_limit
12
21
registrations
attendee_idsession_idregistered_at
50112024-05-01 09:00:00
50212024-05-01 09:05:00
50312024-05-01 09:10:00
50422024-05-02 08:00:00
50522024-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 sessions

Solve 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

Related Pandas questions