Skip to content

Commit

Permalink
aggregating candidate info
Browse files Browse the repository at this point in the history
  • Loading branch information
g7xu committed Oct 28, 2024
1 parent 11c931c commit 0745e93
Show file tree
Hide file tree
Showing 5 changed files with 258 additions and 479 deletions.
88 changes: 88 additions & 0 deletions impact_evaluation/eda_delay_analysis.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# import data\n",
"\n",
"candidates_rt = pd.read_csv('../data/temproary_data/candidate_roundTrip_route.csv')\n",
"candidates_rt['round_trip_route_IATA'] = candidates_rt['round_trip_route_IATA'].apply(eval)\n",
"roundTrips = pd.read_csv('../data/temproary_data/round_trip_flights.csv')\n",
"airports_info = pd.read_csv('../data/cleaned_data/Airport_Codes.csv')\n",
"tickets_info = pd.read_csv('../data/cleaned_data/Tickets.csv')\n",
"\n",
"tickets_info = tickets_info.assign(\n",
" sorted_route=tickets_info.apply(\n",
" lambda x: tuple(\n",
" sorted([x[\"ORIGIN_AIRPORT_IATA_CODE\"], x[\"DEST_AIRPORT_IATA_CODE\"]])\n",
" ),\n",
" axis=1,\n",
" )\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# gather relevent data\n",
"\n",
"airports_can = {i for pair in candidates_rt['round_trip_route_IATA'].values for i in pair}\n",
"\n",
"candidate_roundTrips = roundTrips[roundTrips['round_trip_route_IATA'].isin(candidates_rt['round_trip_route_IATA'])]\n",
"candidate_airports = airports_info[airports_info['AIRPORT_IATA_CODE'].apply(lambda x: x in airports_can)]\n",
"candidate_tickets = tickets_info[tickets_info['sorted_route'].isin(candidates_rt['round_trip_route_IATA'])]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Delay analysis"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "tongConsultinInc",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.19"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit 0745e93

Please sign in to comment.