runtime
425 / 500
question 425 pandas Transformations · medium

Departed flights per airline and airport

Write departures_grid(flights): from a flights DataFrame (airline_code, origin, cancelled as 0/1, and more), return a table with one row per airline and one column per origin airport, counting the flights that actually departed (cancelled == 0), with 0 where an airline had none from that airport. Airlines and airports with no departed flight at all don't appear.

Functiondepartures_grid(flights)
Returnsa DataFrame: index = airline codes, columns = origin airports, values = counts

Loading your progress…

Departed flights per airline and airport — Python practice · Runtime