У меня есть файл с именем маршруты из https://openflights.org/data.php со следующими столбцами:
Airline 2-letter (IATA) or 3-letter (ICAO) code of the airline.
Airline ID Unique OpenFlights identifier for airline (see Airline).
Source airport 3-letter (IATA) or 4-letter (ICAO) code of the source airport.
Source airport ID Unique OpenFlights identifier for source airport (see Airport)
Destination airport 3-letter (IATA) or 4-letter (ICAO) code of the destination airport.
Destination airport ID Unique OpenFlights identifier for destination airport (see Airport)
Codeshare "Y" if this flight is a codeshare (that is, not operated by Airline, but another carrier), empty otherwise.
Stops Number of stops on this flight ("0" for direct)
Equipment 3-letter codes for plane type(s) generally used on this flight, separated by spaces
.
Во-первых, я хочу найти те маршруты, которые получены из пунктов назначения моих прямых рейсов из определенного аэропорта (например, LEX). . Затем сделайте то же самое для двух маршрутов передачи.
Я использовал pandas для создания фреймов данных из CSV.
# Get the list of all destination airports from LEX
lex_destinations = lex_routes['dest'].unique()
# Select routes from those destination airports
one_transfer_routes = routes[routes['source'].isin(lex_destinations)]
# Remove routes that come back to LEX (or revisit any airport twice)
one_transfer_routes = one_transfer_routes[~one_transfer_routes['dest'].isin(['LEX'])]
#Join with the airports to have the lat, lon to plot them using folium
one_transfer_routes_1 = pd.merge(one_transfer_routes, airports,
left_on='dest_id',
right_on='id',
how='left',
suffixes=['_source','_dest'])
# Get the list of all destinations from LEX's first connections
first_transfer_destinations = one_transfer_routes['dest'].unique()
# Get routes from those destinations to find second transfer connections
two_transfer_routes = routes[routes['source'].isin(first_transfer_destinations)]
# Again, filter out any routes that come back to LEX or revisit any airport twice
two_transfer_routes = two_transfer_routes[~two_transfer_routes['dest'].isin(['LEX'])]
two_transfer_routes = pd.merge(two_transfer_routes, airports,
left_on='dest_id',
right_on='id',
how='left',
suffixes=['_source','_dest'])
Подробнее здесь: https://stackoverflow.com/questions/790 ... he-two-tra
Как мне найти прямые рейсы, один маршрут пересадки и два маршрута пересадки из определенного пункта назначения? Использо ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Jetpack Compose Navigation: получить маршрут текущего пункта назначения в виде строки.
Anonymous » » в форуме Android - 0 Ответы
- 16 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Приложение Google Map не показывает полный адрес пункта назначения на устройстве
Anonymous » » в форуме IOS - 0 Ответы
- 36 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Испорченные пакеты из libnetfilter_queue не доходят до пункта назначения
Anonymous » » в форуме Linux - 0 Ответы
- 48 Просмотры
-
Последнее сообщение Anonymous
-