runtime
423 / 500
question 423 pandas Transformations · easy

The busiest departure hour

An airport plans staff around its busiest hour. Write busiest_hour(departures): given scheduled departure times like "2025-01-10 05:13", return the hour (0–23) with the most departures. On a tie, return the earliest of those hours; with no departures, return None.

Functionbusiest_hour(departures)
Returnsan int from 0 to 23, or None
Examples
callbusiest_hour(['2025-01-10 00:59', '2025-01-10 05:00', '2025-01-10 05:01', '2025-01-10 05:10', '2025-01-10 05:13', '2025-01-10 05:15', '2025-01-10 05:15', '2025-01-10 05:15', '2025-01-10 05:20', '2025-01-10 05:20', '2025-01-10 05:20', '2025-01-10 05:22'])returns5
callbusiest_hour(['2025-01-10 00:59', '2025-01-10 05:00', '2025-01-10 05:13'])returns5
callbusiest_hour([])returnsNone

Loading your progress…

The busiest departure hour — Python practice · Runtime