S06 · interview simulation
Python gym: turning cumulative booking curves into pickup in pandas
People, data and outputs in this scenario are simulated. Each stage is recorded when you commit; the reveal comes after.
- 5stages
- 35 minabout
- 0stages committed
The brief
A Python interview (simulated) with the course's synthetic booking_curve joined to route and market. In 2024 it has
90,402 rows: one row per flight and departure date and 13 snapshots at 90, 60, 45, 30, 21, 14, 10, 7, 5, 3, 2, 1 and
0 days before departure.
Columns: date, flight_no, route, market, days_to_departure, bookings (bookings made since the previous
snapshot) and cumulative_bookings. The frame is passed in shuffled; no row order may be assumed.
Example, flight ZX104 departing 2024-07-15:
| days_to_departure | 90 | 60 | 45 | 30 | 21 | 14 | 10 | 7 | 5 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| bookings | 3 | 14 | 22 | 27 | 23 | 22 | 12 | 9 | 9 | 7 | 7 | 4 | 2 |
| cumulative_bookings | 3 | 17 | 39 | 66 | 89 | 111 | 123 | 132 | 141 | 148 | 155 | 159 | 161 |
Stage 1 of 5
The interviewer: "What share of final bookings has a flight typically made by 30 days before departure?"
Which implementation answers it, per flight and departure date?