{ "cells": [ { "cell_type": "code", "execution_count": 96, "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import pandas as pd \n", "import numpy as np \n", "import plotly.plotly as py \n", "import plotly.graph_objs as go \n", "from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot\n", "\n", "init_notebook_mode(connected=True) \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### Importing the dataset from the 'Data' folder from Coursera's cloud that I have access to. " ] }, { "cell_type": "code", "execution_count": 97, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
yearmonthcarriercarrier_nameairportairport_namearr_flightsarr_del15carrier_ctweather_ct...security_ctlate_aircraft_ctarr_cancelledarr_divertedarr_delaycarrier_delayweather_delaynas_delaysecurity_delaylate_aircraft_delay
0200911ASAlaska Airlines Inc.BRWBarrow, AK: Wiley Post/Will Rogers Memorial65.014.03.611.06...0.06.190.01.0920.0592.034.078.00.0216.0
1200911ASAlaska Airlines Inc.BURBurbank, CA: Bob Hope85.05.01.000.00...0.00.980.00.0134.025.00.070.00.039.0
2200911ASAlaska Airlines Inc.CDVCordova, AK: Merle K Mudhole Smith58.08.02.041.00...0.02.964.02.0586.0174.037.062.00.0313.0
3200911ASAlaska Airlines Inc.DCAWashington, DC: Ronald Reagan Washington National88.011.01.990.00...0.00.000.00.0266.065.00.0201.00.00.0
4200911ASAlaska Airlines Inc.DENDenver, CO: Denver International123.05.03.470.00...0.00.000.00.081.057.00.024.00.00.0
\n", "

5 rows × 21 columns

\n", "
" ], "text/plain": [ " year month carrier carrier_name airport \\\n", "0 2009 11 AS Alaska Airlines Inc. BRW \n", "1 2009 11 AS Alaska Airlines Inc. BUR \n", "2 2009 11 AS Alaska Airlines Inc. CDV \n", "3 2009 11 AS Alaska Airlines Inc. DCA \n", "4 2009 11 AS Alaska Airlines Inc. DEN \n", "\n", " airport_name arr_flights arr_del15 \\\n", "0 Barrow, AK: Wiley Post/Will Rogers Memorial 65.0 14.0 \n", "1 Burbank, CA: Bob Hope 85.0 5.0 \n", "2 Cordova, AK: Merle K Mudhole Smith 58.0 8.0 \n", "3 Washington, DC: Ronald Reagan Washington National 88.0 11.0 \n", "4 Denver, CO: Denver International 123.0 5.0 \n", "\n", " carrier_ct weather_ct ... security_ct late_aircraft_ct arr_cancelled \\\n", "0 3.61 1.06 ... 0.0 6.19 0.0 \n", "1 1.00 0.00 ... 0.0 0.98 0.0 \n", "2 2.04 1.00 ... 0.0 2.96 4.0 \n", "3 1.99 0.00 ... 0.0 0.00 0.0 \n", "4 3.47 0.00 ... 0.0 0.00 0.0 \n", "\n", " arr_diverted arr_delay carrier_delay weather_delay nas_delay \\\n", "0 1.0 920.0 592.0 34.0 78.0 \n", "1 0.0 134.0 25.0 0.0 70.0 \n", "2 2.0 586.0 174.0 37.0 62.0 \n", "3 0.0 266.0 65.0 0.0 201.0 \n", "4 0.0 81.0 57.0 0.0 24.0 \n", "\n", " security_delay late_aircraft_delay \n", "0 0.0 216.0 \n", "1 0.0 39.0 \n", "2 0.0 313.0 \n", "3 0.0 0.0 \n", "4 0.0 0.0 \n", "\n", "[5 rows x 21 columns]" ] }, "execution_count": 97, "metadata": {}, "output_type": "execute_result" } ], "source": [ "maindf = pd.read_csv('data/airline_delay_causes.csv')\n", "maindf = maindf.iloc[:, :21]\n", "maindf.head()" ] }, { "cell_type": "code", "execution_count": 98, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'AirTran Airways Corporation',\n", " 'Alaska Airlines Inc.',\n", " 'Allegiant Air',\n", " 'American Airlines Inc.',\n", " 'American Eagle Airlines Inc.',\n", " 'Atlantic Southeast Airlines',\n", " 'Comair Inc.',\n", " 'Continental Air Lines Inc.',\n", " 'Delta Air Lines Inc.',\n", " 'Endeavor Air Inc.',\n", " 'Envoy Air',\n", " 'ExpressJet Airlines Inc.',\n", " 'Frontier Airlines Inc.',\n", " 'Hawaiian Airlines Inc.',\n", " 'JetBlue Airways',\n", " 'Mesa Airlines Inc.',\n", " 'Northwest Airlines Inc.',\n", " 'PSA Airlines Inc.',\n", " 'Pinnacle Airlines Inc.',\n", " 'Republic Airline',\n", " 'SkyWest Airlines Inc.',\n", " 'Southwest Airlines Co.',\n", " 'Spirit Air Lines',\n", " 'US Airways Inc.',\n", " 'United Air Lines Inc.',\n", " 'Virgin America'}" ] }, "execution_count": 98, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Let's find the names of all individual airlines, so that we get an idea of how many unique airlines are there in the data\n", "set(list(maindf['carrier_name']))\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Now, I want to group the data set using 'groupby' on the Airlines. But the column names are not consistent as some have a space before the name starts. So let's print out the column names which we can then use to copy and paste in our code for smooth functioning." ] }, { "cell_type": "code", "execution_count": 99, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['year', ' month', 'carrier', 'airport', 'airport_name', 'arr_flights',\n", " 'arr_del15', 'carrier_ct', ' weather_ct', 'nas_ct', 'security_ct',\n", " 'late_aircraft_ct', 'arr_cancelled', 'arr_diverted', ' arr_delay',\n", " ' carrier_delay', 'weather_delay', 'nas_delay', 'security_delay',\n", " 'late_aircraft_delay'],\n", " dtype='object')" ] }, "execution_count": 99, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Find out the column names to write them properly in code:\n", "maindf.set_index('carrier_name').columns #since we're going to group by 'Carrier Name'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### Now, I'm interested in the ' arr_delay' column which is the Sum of Delay Minutes. We will be using this column and the airline names ('carrier_names') in our initial plots." ] }, { "cell_type": "code", "execution_count": 100, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "14" ] }, "execution_count": 100, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Find the index of relevant column to use in the following GroupBy statement\n", "list(maindf.set_index('carrier_name').columns).index(' arr_delay')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### Trial, Trial2, and so on are just names to new series, and objects. Not to be confused for anything. " ] }, { "cell_type": "code", "execution_count": 101, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "carrier_name\n", "Southwest Airlines Co. 115771486.0\n", "American Airlines Inc. 78815786.0\n", "SkyWest Airlines Inc. 72789590.0\n", "Delta Air Lines Inc. 71621393.0\n", "ExpressJet Airlines Inc. 68781482.0\n", "United Air Lines Inc. 57915309.0\n", "JetBlue Airways 38036618.0\n", "American Eagle Airlines Inc. 26718814.0\n", "US Airways Inc. 20966493.0\n", "Frontier Airlines Inc. 12947465.0\n", "Atlantic Southeast Airlines 12936567.0\n", "Envoy Air 12111571.0\n", "Mesa Airlines Inc. 11538648.0\n", "Alaska Airlines Inc. 11065065.0\n", "AirTran Airways Corporation 11019631.0\n", "Spirit Air Lines 9062640.0\n", "Continental Air Lines Inc. 7413086.0\n", "Pinnacle Airlines Inc. 6645291.0\n", "Endeavor Air Inc. 4972029.0\n", "Virgin America 4895524.0\n", "Republic Airline 4333426.0\n", "PSA Airlines Inc. 4180379.0\n", "Comair Inc. 3988422.0\n", "Hawaiian Airlines Inc. 2809143.0\n", "Northwest Airlines Inc. 2643000.0\n", "Allegiant Air 1793203.0\n", "Name: arr_delay, dtype: float64" ] }, "execution_count": 101, "metadata": {}, "output_type": "execute_result" } ], "source": [ "trial = maindf.set_index('carrier_name').iloc[:, list(maindf.set_index('carrier_name').columns).index(' arr_delay')].groupby(level = 0).sum()\n", "trial2 = trial.sort_values(ascending = False)\n", "trial2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### First Few Plots" ] }, { "cell_type": "code", "execution_count": 102, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "type": "bar", "uid": "2d6517be-28c3-4151-b3bc-5b5e256826b3", "x": [ "Southwest Airlines Co.", "American Airlines Inc.", "SkyWest Airlines Inc.", "Delta Air Lines Inc.", "ExpressJet Airlines Inc.", "United Air Lines Inc.", "JetBlue Airways", "American Eagle Airlines Inc.", "US Airways Inc.", "Frontier Airlines Inc.", "Atlantic Southeast Airlines", "Envoy Air", "Mesa Airlines Inc.", "Alaska Airlines Inc.", "AirTran Airways Corporation", "Spirit Air Lines", "Continental Air Lines Inc.", "Pinnacle Airlines Inc.", "Endeavor Air Inc.", "Virgin America", "Republic Airline", "PSA Airlines Inc.", "Comair Inc.", "Hawaiian Airlines Inc.", "Northwest Airlines Inc.", "Allegiant Air" ], "y": [ 115771486, 78815786, 72789590, 71621393, 68781482, 57915309, 38036618, 26718814, 20966493, 12947465, 12936567, 12111571, 11538648, 11065065, 11019631, 9062640, 7413086, 6645291, 4972029, 4895524, 4333426, 4180379, 3988422, 2809143, 2643000, 1793203 ] } ], "layout": {} }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "#Let's create a Bar graph! \n", "# First, create a trace: \n", "x = list(trial2.index)\n", "y = list(trial2)\n", "iplot([go.Bar(x=x, y=y)], filename = 'Delay Bar Chart (minutes)')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### But this is not an accurate representation. Let's calculate the Average Lateness per each flight of airlines. But before that we need to find out the total number of flights per airline. " ] }, { "cell_type": "code", "execution_count": 103, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "5" ] }, "execution_count": 103, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Find the index of relevant column to use in the following GroupBy statement\n", "list(maindf.set_index('carrier_name').columns).index('arr_flights')" ] }, { "cell_type": "code", "execution_count": 104, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "carrier_name\n", "AirTran Airways Corporation 1201121.0\n", "Alaska Airlines Inc. 1689757.0\n", "Allegiant Air 110255.0\n", "American Airlines Inc. 6785529.0\n", "American Eagle Airlines Inc. 2300220.0\n", "Atlantic Southeast Airlines 923459.0\n", "Comair Inc. 286694.0\n", "Continental Air Lines Inc. 721450.0\n", "Delta Air Lines Inc. 7951812.0\n", "Endeavor Air Inc. 404370.0\n", "Envoy Air 932356.0\n", "ExpressJet Airlines Inc. 4891450.0\n", "Frontier Airlines Inc. 915000.0\n", "Hawaiian Airlines Inc. 751950.0\n", "JetBlue Airways 2516031.0\n", "Mesa Airlines Inc. 1080705.0\n", "Northwest Airlines Inc. 270188.0\n", "PSA Airlines Inc. 323091.0\n", "Pinnacle Airlines Inc. 678801.0\n", "Republic Airline 365631.0\n", "SkyWest Airlines Inc. 6346731.0\n", "Southwest Airlines Co. 12216352.0\n", "Spirit Air Lines 617450.0\n", "US Airways Inc. 2624022.0\n", "United Air Lines Inc. 4887878.0\n", "Virgin America 389060.0\n", "Name: arr_flights, dtype: float64" ] }, "execution_count": 104, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\n", "Total_flights_per_airline = maindf.set_index('carrier_name').iloc[:, list(maindf.set_index('carrier_name').columns).index('arr_flights')].groupby(level = 0).sum()\n", "Total_flights_per_airline" ] }, { "cell_type": "code", "execution_count": 105, "metadata": {}, "outputs": [], "source": [ "new_df = pd.DataFrame({'Total Delay': trial, 'Total No. of Flights': Total_flights_per_airline})\n", "new_df['Delay/Flight'] = new_df['Total Delay']/new_df['Total No. of Flights']\n", "trial3 = new_df['Delay/Flight'].sort_values(ascending = False)\n", "\n", "\n" ] }, { "cell_type": "code", "execution_count": 106, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "type": "bar", "uid": "bac00cb4-6cd1-4d6e-b627-a74d9562f945", "x": [ "Allegiant Air", "JetBlue Airways", "Spirit Air Lines", "Frontier Airlines Inc.", "ExpressJet Airlines Inc.", "Atlantic Southeast Airlines", "Comair Inc.", "Envoy Air", "PSA Airlines Inc.", "Virgin America", "Endeavor Air Inc.", "Republic Airline", "United Air Lines Inc.", "American Eagle Airlines Inc.", "American Airlines Inc.", "SkyWest Airlines Inc.", "Mesa Airlines Inc.", "Continental Air Lines Inc.", "Pinnacle Airlines Inc.", "Northwest Airlines Inc.", "Southwest Airlines Co.", "AirTran Airways Corporation", "Delta Air Lines Inc.", "US Airways Inc.", "Alaska Airlines Inc.", "Hawaiian Airlines Inc." ], "y": [ 16.264142215772527, 15.117706419356518, 14.677528544821444, 14.150234972677596, 14.061573153154995, 14.008815767673497, 13.911773528570532, 12.990285899377492, 12.938704575491116, 12.582953786048424, 12.295741523851918, 11.851910806250016, 11.848763205628291, 11.615764579040265, 11.615275094985225, 11.4688317497622, 10.676963648729302, 10.275259546746137, 9.789748394595765, 9.782077664441056, 9.476764094551303, 9.174455362948446, 9.006927351904196, 7.990212353402525, 6.548317302428693, 3.735810891681628 ] } ], "layout": {} }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Now let's create a bar plot to compare the delay/flight of specific airlines\n", "# Creating traces\n", "\n", "x1 = list(trial3.index)\n", "y1 = list(trial3)\n", "iplot([go.Bar(x=x1, y=y1)], filename = 'Delay/Flight of Airline from Nov 2009 - Feb 2019')" ] }, { "cell_type": "code", "execution_count": 107, "metadata": { "scrolled": false }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "marker": { "color": [ "rgb(130,0,0)", "rgb(130,0,0)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)", "rgb(204,204,205)" ] }, "name": "Delay/Flight of Airline from Nov 2009 - Feb 2019", "text": [ 16.3, 15.1, 14.7, 14.2, 14.1, 14, 13.9, 13, 12.9, 12.6, 12.3, 11.9, 11.8, 11.6, 11.6, 11.5, 10.7, 10.3, 9.8, 9.8, 9.5, 9.2, 9, 8, 6.5, 3.7 ], "textposition": "auto", "type": "bar", "uid": "8dac8288-23b3-4977-9508-12e99cacbbd4", "x": [ "Allegiant Air", "JetBlue Airways", "Spirit Air Lines", "Frontier Airlines Inc.", "ExpressJet Airlines Inc.", "Atlantic Southeast Airlines", "Comair Inc.", "Envoy Air", "PSA Airlines Inc.", "Virgin America", "Endeavor Air Inc.", "Republic Airline", "United Air Lines Inc.", "American Eagle Airlines Inc.", "American Airlines Inc.", "SkyWest Airlines Inc.", "Mesa Airlines Inc.", "Continental Air Lines Inc.", "Pinnacle Airlines Inc.", "Northwest Airlines Inc.", "Southwest Airlines Co.", "AirTran Airways Corporation", "Delta Air Lines Inc.", "US Airways Inc.", "Alaska Airlines Inc.", "Hawaiian Airlines Inc." ], "y": [ 16.264142215772527, 15.117706419356518, 14.677528544821444, 14.150234972677596, 14.061573153154995, 14.008815767673497, 13.911773528570532, 12.990285899377492, 12.938704575491116, 12.582953786048424, 12.295741523851918, 11.851910806250016, 11.848763205628291, 11.615764579040265, 11.615275094985225, 11.4688317497622, 10.676963648729302, 10.275259546746137, 9.789748394595765, 9.782077664441056, 9.476764094551303, 9.174455362948446, 9.006927351904196, 7.990212353402525, 6.548317302428693, 3.735810891681628 ] } ], "layout": { "bargap": 0.3, "title": { "text": "Delay/Flight of Airline from Nov 2009 - Feb 2019
(Airlines with over 15 mins in red)" }, "yaxis": { "title": { "text": "No. of minutes" } } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Add some color to the above graph \n", "color = np.array(['rgb(255,255,255)']*trial3.shape[0])\n", "color[trial3>=15] = 'rgb(130,0,0)'\n", "color[trial3<15]= 'rgb(204,204,205)'\n", "data=[dict(type='bar',\n", " x=trial3.index,\n", " y=trial3,\n", " marker=dict(color=color.tolist()),\n", " text = round(trial3,1), \n", " textposition = 'auto',\n", " name = 'Delay/Flight of Airline from Nov 2009 - Feb 2019' \n", " )]\n", "layout = go.Layout(bargap = 0.3, title = 'Delay/Flight of Airline from Nov 2009 - Feb 2019
(Airlines with over 15 mins in red)', \n", " yaxis = dict(title = 'No. of minutes'))\n", "fig = go.Figure(data = data, layout = layout)\n", "iplot(fig)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### From the above visualization it is safe to say that over the past 10 years (approx): \n", "Each Hawaiin Airline flight has been delayed by around 3.7 minutes! \n", "\n", "And Allegiant Air flights are late by around 16.2 minutes. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Line/Scatter Plot\n", "\n", "Now let's plot the performance of airlines across the years. Note that for 2009, we only have data from Month 11 onward. i.e. Month 11 & 12. \n", "\n", "Thus for this, we will create and group by a 'Multi-index' of Airline name ('carrier_name') & Year. " ] }, { "cell_type": "code", "execution_count": 108, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "13" ] }, "execution_count": 108, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Now for this too, let's find out the index of the ' arr_delay' column since this group by is going to be a multi-index\n", "new_index = list(maindf.set_index(['carrier_name', 'year']).columns).index(' arr_delay')\n", "new_index\n" ] }, { "cell_type": "code", "execution_count": 109, "metadata": {}, "outputs": [], "source": [ "# Now, let's plot the average lateness per flight per each year. \n", "# We are provided with only 2 months of the year 2009 so we will ignore that later on. \n", "trial_series = maindf.set_index(['carrier_name', 'year']).iloc[:, new_index].groupby(level =[0,1]).sum()\n" ] }, { "cell_type": "code", "execution_count": 110, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "carrier_name year\n", "AirTran Airways Corporation 2009 2949355.0\n", " 2010 2250331.0\n", " 2011 1990102.0\n", " 2012 1359781.0\n", " 2013 1791450.0\n", " 2014 678612.0\n", "Alaska Airlines Inc. 2009 859073.0\n", " 2010 741330.0\n", " 2011 766706.0\n", " 2012 872417.0\n", " 2013 848473.0\n", " 2014 989491.0\n", " 2015 1074977.0\n", " 2016 996624.0\n", " 2017 1454555.0\n", " 2018 1942070.0\n", " 2019 519349.0\n", "Allegiant Air 2018 1565764.0\n", " 2019 227439.0\n", "American Airlines Inc. 2009 6227014.0\n", "Name: arr_delay, dtype: float64" ] }, "execution_count": 110, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Let's see what the series looks like. \n", "trial_series.head(20)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### I know, we can groupby the dataframe and create a new Data Frame, and then select the appropriate columns but I'm just doing it this way because it's slightly more comprehensible, comapred to the clutter the groupby statement creates (which you will notice later on in the project)" ] }, { "cell_type": "code", "execution_count": 111, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "4" ] }, "execution_count": 111, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# to find index of 'arr_flights' column in Multi_index: \n", "list(maindf.set_index(['carrier_name', 'year']).columns).index('arr_flights')" ] }, { "cell_type": "code", "execution_count": 112, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "carrier_name year\n", "AirTran Airways Corporation 2009 231965.0\n", " 2010 248844.0\n", " 2011 248703.0\n", " 2012 218162.0\n", " 2013 173952.0\n", " 2014 79495.0\n", "Alaska Airlines Inc. 2009 126110.0\n", " 2010 136950.0\n", " 2011 143726.0\n", " 2012 147569.0\n", " 2013 154743.0\n", " 2014 160257.0\n", " 2015 172521.0\n", " 2016 177280.0\n", " 2017 185068.0\n", " 2018 245761.0\n", " 2019 39772.0\n", "Allegiant Air 2018 96221.0\n", " 2019 14034.0\n", "American Airlines Inc. 2009 503858.0\n", "Name: arr_flights, dtype: float64" ] }, "execution_count": 112, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Total_flights_per_airline_per_year = maindf.set_index(['carrier_name', 'year']).iloc[:, list(maindf.set_index(['carrier_name', 'year']).columns).index('arr_flights')].groupby(level = [0,1]).sum()\n", "Total_flights_per_airline_per_year.head(20)" ] }, { "cell_type": "code", "execution_count": 113, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Total DelayTotal No. of FlightsDelay/Flight
carrier_nameyear
AirTran Airways Corporation20092949355.0231965.012.714655
20102250331.0248844.09.043139
20111990102.0248703.08.001922
20121359781.0218162.06.232896
20131791450.0173952.010.298531
2014678612.079495.08.536537
Alaska Airlines Inc.2009859073.0126110.06.812093
2010741330.0136950.05.413143
2011766706.0143726.05.334498
2012872417.0147569.05.911926
2013848473.0154743.05.483111
2014989491.0160257.06.174401
20151074977.0172521.06.230992
2016996624.0177280.05.621751
20171454555.0185068.07.859571
20181942070.0245761.07.902271
2019519349.039772.013.058156
Allegiant Air20181565764.096221.016.272581
2019227439.014034.016.206285
American Airlines Inc.20096227014.0503858.012.358669
\n", "
" ], "text/plain": [ " Total Delay Total No. of Flights \\\n", "carrier_name year \n", "AirTran Airways Corporation 2009 2949355.0 231965.0 \n", " 2010 2250331.0 248844.0 \n", " 2011 1990102.0 248703.0 \n", " 2012 1359781.0 218162.0 \n", " 2013 1791450.0 173952.0 \n", " 2014 678612.0 79495.0 \n", "Alaska Airlines Inc. 2009 859073.0 126110.0 \n", " 2010 741330.0 136950.0 \n", " 2011 766706.0 143726.0 \n", " 2012 872417.0 147569.0 \n", " 2013 848473.0 154743.0 \n", " 2014 989491.0 160257.0 \n", " 2015 1074977.0 172521.0 \n", " 2016 996624.0 177280.0 \n", " 2017 1454555.0 185068.0 \n", " 2018 1942070.0 245761.0 \n", " 2019 519349.0 39772.0 \n", "Allegiant Air 2018 1565764.0 96221.0 \n", " 2019 227439.0 14034.0 \n", "American Airlines Inc. 2009 6227014.0 503858.0 \n", "\n", " Delay/Flight \n", "carrier_name year \n", "AirTran Airways Corporation 2009 12.714655 \n", " 2010 9.043139 \n", " 2011 8.001922 \n", " 2012 6.232896 \n", " 2013 10.298531 \n", " 2014 8.536537 \n", "Alaska Airlines Inc. 2009 6.812093 \n", " 2010 5.413143 \n", " 2011 5.334498 \n", " 2012 5.911926 \n", " 2013 5.483111 \n", " 2014 6.174401 \n", " 2015 6.230992 \n", " 2016 5.621751 \n", " 2017 7.859571 \n", " 2018 7.902271 \n", " 2019 13.058156 \n", "Allegiant Air 2018 16.272581 \n", " 2019 16.206285 \n", "American Airlines Inc. 2009 12.358669 " ] }, "execution_count": 113, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_df = pd.DataFrame({'Total Delay': trial_series, 'Total No. of Flights': Total_flights_per_airline_per_year})\n", "new_df['Delay/Flight'] = new_df['Total Delay']/new_df['Total No. of Flights']\n", "new_df.head(20)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### Let's try out an initial scatter plot for AirTran Airways Corporation as an example: " ] }, { "cell_type": "code", "execution_count": 114, "metadata": { "scrolled": true }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "mode": "lines+markers", "type": "scatter", "uid": "10d87932-f228-450a-aab6-4724d1e01a96", "x": [ 2009, 2010, 2011, 2012, 2013, 2014 ], "y": [ 12.71465522815942, 9.043139476941377, 8.001921971186515, 6.232895738029538, 10.298530629139073, 8.536536889112522 ] } ], "layout": {} }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "#AirTran Airways has data only till 2014. \n", "trace1 = go.Scatter(x=list(new_df.loc[['AirTran Airways Corporation']].index.get_level_values('year')),\n", " y= list(new_df.loc[['AirTran Airways Corporation']].ix[:,2]),\n", " mode='lines+markers')\n", "\n", "iplot([trace1],filename='line chart')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Let's try out a Grouped Scatter Plot\n", "\n", "We will use data of all airlines across all years and see what plot we get. Could get a little messy, so let's split the graphs. For that we will need to create a list of all the airlines and split it. " ] }, { "cell_type": "code", "execution_count": 115, "metadata": {}, "outputs": [], "source": [ "#list of airlines\n", "list_of_airlines = list(set(list(new_df.index.get_level_values('carrier_name'))))\n", "split1 = list_of_airlines[:int(len(list_of_airlines)/2)]\n", "split2 = list_of_airlines[int(len(list_of_airlines)/2):]\n" ] }, { "cell_type": "code", "execution_count": 116, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "mode": "lines+markers", "name": "American Airlines Inc.", "text": "American Airlines Inc.", "type": "scatter", "uid": "ea6842a8-0ec1-48a2-9549-7276aba28b15", "x": [ 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 ], "y": [ 12.35866851374792, 10.289036403598768, 11.00106470152124, 11.811918814972774, 11.816014768791447, 13.262631184477502, 10.787338288447128, 11.710687319230832, 10.898615269962113, 12.365002650471522, 11.920716388881385 ] }, { "mode": "lines+markers", "name": "Comair Inc.", "text": "Comair Inc.", "type": "scatter", "uid": "c712ca37-f9f2-467f-9811-1b15938eb68e", "x": [ 2009, 2010 ], "y": [ 14.991895642919294, 12.894366435688498 ] }, { "mode": "lines+markers", "name": "Virgin America", "text": "Virgin America", "type": "scatter", "uid": "22271ad6-545c-4fec-8e1e-142400af1755", "x": [ 2012, 2013, 2014, 2015, 2016, 2017, 2018 ], "y": [ 11.30519527967557, 12.03610872875571, 11.606242392627369, 10.712194885546742, 12.859839990740875, 16.67585691945732, 10.517826825127335 ] }, { "mode": "lines+markers", "name": "PSA Airlines Inc.", "text": "PSA Airlines Inc.", "type": "scatter", "uid": "f370bd6b-280f-4a24-9a6a-6fd63da1ac4c", "x": [ 2018, 2019 ], "y": [ 13.258305591168474, 10.94481785186181 ] }, { "mode": "lines+markers", "name": "US Airways Inc.", "text": "US Airways Inc.", "type": "scatter", "uid": "6a3fe835-afb4-4a60-8392-18e258675331", "x": [ 2009, 2010, 2011, 2012, 2013, 2014, 2015 ], "y": [ 8.319938196643676, 7.2734561335851895, 8.983021211869255, 5.913239648446679, 8.319645078606019, 8.507966671891769, 9.24975467377903 ] }, { "mode": "lines+markers", "name": "Hawaiian Airlines Inc.", "text": "Hawaiian Airlines Inc.", "type": "scatter", "uid": "787f5331-491f-4bfd-bf92-08ce1fa6dbe2", "x": [ 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 ], "y": [ 3.124326676369529, 3.1984803914322457, 3.1499250824093497, 3.0761580914598765, 3.1061478017873445, 3.303123160092062, 4.473358506398154, 3.5673208402245113, 4.834293768397944, 4.636957586326338, 6.550307848180188 ] }, { "mode": "lines+markers", "name": "Atlantic Southeast Airlines", "text": "Atlantic Southeast Airlines", "type": "scatter", "uid": "41b3195d-e44a-4cbf-9ea6-c44b02157146", "x": [ 2009, 2010, 2011 ], "y": [ 15.60617063182598, 12.13085730539727, 14.498128688862115 ] }, { "mode": "lines+markers", "name": "Alaska Airlines Inc.", "text": "Alaska Airlines Inc.", "type": "scatter", "uid": "3f2e0553-2dfd-4da0-baf7-379a87779bde", "x": [ 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 ], "y": [ 6.812092617556102, 5.413143483023001, 5.334497585683871, 5.91192594650638, 5.483110706138565, 6.174401118203885, 6.230992169069273, 5.621750902527076, 7.85957053623533, 7.902270905473204, 13.058156492004425 ] }, { "mode": "lines+markers", "name": "Pinnacle Airlines Inc.", "text": "Pinnacle Airlines Inc.", "type": "scatter", "uid": "e650e960-116e-4b4a-b867-7e36201ea97e", "x": [ 2009, 2010, 2013 ], "y": [ 7.781478773173347, 10.004239298449672, 12.20728595594933 ] }, { "mode": "lines+markers", "name": "Frontier Airlines Inc.", "text": "Frontier Airlines Inc.", "type": "scatter", "uid": "d87f62b0-4f40-4d03-8fa8-065ea46b4a2f", "x": [ 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 ], "y": [ 9.77067876478845, 8.820132737964522, 9.946902965432532, 10.03021891363321, 14.788565307094112, 15.525458034022042, 17.436247743185522, 15.991968124809453, 14.075300649344346, 20.864406214854, 16.025112790128826 ] }, { "mode": "lines+markers", "name": "ExpressJet Airlines Inc.", "text": "ExpressJet Airlines Inc.", "type": "scatter", "uid": "8d01d1f7-b2aa-447d-90d6-27efeca6643f", "x": [ 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 ], "y": [ 12.128393773371597, 11.220080659192837, 13.653900688627246, 13.814786969110015, 15.834711284686977, 15.776097233175078, 11.976278766453897, 12.85081773559543, 15.925661407606151, 16.536517324658682, 20.13432351270189 ] }, { "mode": "lines+markers", "name": "American Eagle Airlines Inc.", "text": "American Eagle Airlines Inc.", "type": "scatter", "uid": "aa7dbb37-3506-41da-a8a8-f7c97b4c6d41", "x": [ 2009, 2010, 2011, 2012, 2013, 2014 ], "y": [ 10.883712369923794, 10.932497436930175, 11.071661259588824, 9.477847994251173, 14.95063258045082, 15.430247327205993 ] }, { "mode": "lines+markers", "name": "Endeavor Air Inc.", "text": "Endeavor Air Inc.", "type": "scatter", "uid": "df94f7de-ab73-414a-a7ba-14aed3db5649", "x": [ 2013, 2018, 2019 ], "y": [ 8.016331804918716, 13.899974381600297, 15.381398852037504 ] } ], "layout": { "showlegend": true, "title": { "text": "Delay of Each Airline per Flight by year
First Group of Airlines" }, "xaxis": { "showgrid": true, "ticklen": 5, "title": { "text": "Year" } }, "yaxis": { "rangemode": "tozero", "title": { "text": "Avg. Delay per fligh in minutes" } } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "new_list = [] \n", "for airline in split1:\n", " trace = go.Scatter(x=list(new_df.loc[[airline]].index.get_level_values('year')),\n", " y= list(new_df.loc[[airline]].ix[:,2]),\n", " text = airline, name = airline,\n", " mode='lines+markers')\n", " new_list.append(trace)\n", "\n", " \n", "data = new_list\n", "layout = dict(title = 'Delay of Each Airline per Flight by year
First Group of Airlines',\n", " xaxis= dict(title= 'Year',ticklen= 5,showgrid=True),\n", " yaxis = dict(title= 'Avg. Delay per fligh in minutes', rangemode= 'tozero'),\n", " showlegend=True\n", " )\n", "\n", "fig = dict(data = data, layout = layout)\n", "\n", "iplot(fig)\n", " " ] }, { "cell_type": "code", "execution_count": 117, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "mode": "lines+markers", "name": "Republic Airline", "text": "Republic Airline", "type": "scatter", "uid": "e9e2fdb9-0ba3-4c3a-bb86-c71e4583c172", "x": [ 2018, 2019 ], "y": [ 11.499705779999367, 14.099109828223089 ] }, { "mode": "lines+markers", "name": "JetBlue Airways", "text": "JetBlue Airways", "type": "scatter", "uid": "a088e0ce-1913-479f-a285-7456c151fff1", "x": [ 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 ], "y": [ 13.101030464691844, 13.491525760298659, 15.47231096911608, 12.104673093042749, 14.90105758612275, 12.952822065496429, 13.51891794733531, 15.06176165509624, 18.552502226656934, 18.34756893216616, 22.055955252876753 ] }, { "mode": "lines+markers", "name": "Spirit Air Lines", "text": "Spirit Air Lines", "type": "scatter", "uid": "7a0c4be2-9b2a-4e77-af05-0b5dee84e9df", "x": [ 2015, 2016, 2017, 2018, 2019 ], "y": [ 18.42741035449271, 15.002778601871215, 13.53006670152661, 13.185897217586758, 13.210174539409891 ] }, { "mode": "lines+markers", "name": "Southwest Airlines Co.", "text": "Southwest Airlines Co.", "type": "scatter", "uid": "258e3767-25e6-4667-a2b4-1895c978441b", "x": [ 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 ], "y": [ 7.637078507463551, 8.918931032550843, 8.723613998928803, 7.734664872187175, 10.305559191441793, 13.078674786082122, 9.80412487964148, 8.896187908059138, 9.671897424788106, 9.752507851823811, 9.153145930971672 ] }, { "mode": "lines+markers", "name": "Delta Air Lines Inc.", "text": "Delta Air Lines Inc.", "type": "scatter", "uid": "9cd19af1-8954-46ad-b5b7-1ffdf1a1943a", "x": [ 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 ], "y": [ 10.412952459681431, 11.180772006608702, 8.711338179047452, 7.066928608475413, 8.791295533146938, 8.702956739028581, 8.25442154813268, 8.8409161351011, 9.509133136991641, 8.960978970444009, 10.99228606036565 ] }, { "mode": "lines+markers", "name": "Continental Air Lines Inc.", "text": "Continental Air Lines Inc.", "type": "scatter", "uid": "cfd8b4dd-3a30-48e2-a5e8-c4d96d2160e6", "x": [ 2009, 2010, 2011 ], "y": [ 11.421567923803412, 8.678736662612685, 10.725637743663327 ] }, { "mode": "lines+markers", "name": "Envoy Air", "text": "Envoy Air", "type": "scatter", "uid": "cf4108b7-c6ef-47e8-8f58-73ed280dd519", "x": [ 2014, 2015, 2018, 2019 ], "y": [ 14.041173576758043, 12.938967932878981, 11.560937294130763, 15.655016220848381 ] }, { "mode": "lines+markers", "name": "Mesa Airlines Inc.", "text": "Mesa Airlines Inc.", "type": "scatter", "uid": "bd3fcee3-12c1-4bce-83b7-396320fbec39", "x": [ 2009, 2010, 2011, 2012, 2013, 2018, 2019 ], "y": [ 11.249414801299453, 8.077146632951367, 8.343365515652891, 7.35937033498537, 12.03027206539788, 14.407431509077893, 14.742377742721928 ] }, { "mode": "lines+markers", "name": "United Air Lines Inc.", "text": "United Air Lines Inc.", "type": "scatter", "uid": "39e3834d-3e49-4e11-af4d-df2a1f4a9893", "x": [ 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 ], "y": [ 10.29612115494254, 7.753772432749118, 10.681262290657173, 12.104078156029704, 11.520931280867066, 13.117296283088296, 13.138459987241212, 11.662702016449353, 11.601066587279997, 13.355903244230289, 15.745170294692013 ] }, { "mode": "lines+markers", "name": "Allegiant Air", "text": "Allegiant Air", "type": "scatter", "uid": "a50d8ff8-22cf-44d3-9552-74c2321eafad", "x": [ 2018, 2019 ], "y": [ 16.272580829548644, 16.206284737067122 ] }, { "mode": "lines+markers", "name": "Northwest Airlines Inc.", "text": "Northwest Airlines Inc.", "type": "scatter", "uid": "f94a1435-6fc2-4a9b-8188-e30b3703b423", "x": [ 2009 ], "y": [ 9.782077664441056 ] }, { "mode": "lines+markers", "name": "SkyWest Airlines Inc.", "text": "SkyWest Airlines Inc.", "type": "scatter", "uid": "516536f3-a4a5-494a-9fc5-10cf2e569502", "x": [ 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 ], "y": [ 8.62908120978914, 10.359239184817051, 9.949369394523403, 9.035816730230058, 10.405416063311934, 11.804340733732444, 11.058973099482794, 11.136343457114895, 14.268016650460634, 14.309331552425474, 21.23446974260129 ] }, { "mode": "lines+markers", "name": "AirTran Airways Corporation", "text": "AirTran Airways Corporation", "type": "scatter", "uid": "15bd6038-cb7c-4c68-9012-e22dd5a5a69d", "x": [ 2009, 2010, 2011, 2012, 2013, 2014 ], "y": [ 12.71465522815942, 9.043139476941377, 8.001921971186515, 6.232895738029538, 10.298530629139073, 8.536536889112522 ] } ], "layout": { "showlegend": true, "title": { "text": "Delay of Each Airline per Flight by year
Second Group of Airlines" }, "xaxis": { "showgrid": true, "ticklen": 5, "title": { "text": "Year" } }, "yaxis": { "rangemode": "tozero", "title": { "text": "Avg. Delay per fligh in minutes" } } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "new_list = [] \n", "for airline in split2:\n", " trace = go.Scatter(x=list(new_df.loc[[airline]].index.get_level_values('year')),\n", " y= list(new_df.loc[[airline]].ix[:,2]),\n", " text = airline, name = airline,\n", " mode='lines+markers')\n", " new_list.append(trace)\n", "\n", " \n", "data = new_list\n", "layout = dict(title = 'Delay of Each Airline per Flight by year
Second Group of Airlines',\n", " xaxis= dict(title= 'Year',ticklen= 5,showgrid=True),\n", " yaxis = dict(title= 'Avg. Delay per fligh in minutes', rangemode= 'tozero'),\n", " showlegend=True\n", " )\n", "\n", "fig = dict(data = data, layout = layout)\n", "\n", "iplot(fig)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "#### Nearly all Airlines have a spike from 2017 to 2018, which means that all of them are getting delayed. Let's find out why (from the data provided)\n" ] }, { "cell_type": "code", "execution_count": 118, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
montharr_flightsarr_del15carrier_ctweather_ctnas_ctsecurity_ctlate_aircraft_ctarr_cancelledarr_divertedarr_delaycarrier_delayweather_delaynas_delaysecurity_delaylate_aircraft_delay
year
20091131475917946.01109632.0296652.2536781.26407857.512118.93366223.9676947.014200.060393828.016952697.02923083.018457683.072335.021988030.0
20101151156450117.01174884.0339084.4435854.04376616.893057.76420272.65113255.015474.063257498.019217505.02785212.016229118.0107410.024918253.0
20111015386085281.01109872.0313296.5430963.04352694.642318.39410600.62115978.014399.061675942.018553241.02558373.015303210.081353.025179765.0
2012935106096762.01015158.0302680.2228799.46300169.191980.71381529.3978862.012519.056916692.018165456.02279810.012828822.073052.023569552.0
20131048376369482.01269277.0353206.7536817.01384847.912321.20492086.8396012.014160.071937602.021136897.02974153.017426866.0103651.030296035.0
\n", "
" ], "text/plain": [ " month arr_flights arr_del15 carrier_ct weather_ct nas_ct \\\n", "year \n", "2009 113147 5917946.0 1109632.0 296652.25 36781.26 407857.51 \n", "2010 115115 6450117.0 1174884.0 339084.44 35854.04 376616.89 \n", "2011 101538 6085281.0 1109872.0 313296.54 30963.04 352694.64 \n", "2012 93510 6096762.0 1015158.0 302680.22 28799.46 300169.19 \n", "2013 104837 6369482.0 1269277.0 353206.75 36817.01 384847.91 \n", "\n", " security_ct late_aircraft_ct arr_cancelled arr_diverted arr_delay \\\n", "year \n", "2009 2118.93 366223.96 76947.0 14200.0 60393828.0 \n", "2010 3057.76 420272.65 113255.0 15474.0 63257498.0 \n", "2011 2318.39 410600.62 115978.0 14399.0 61675942.0 \n", "2012 1980.71 381529.39 78862.0 12519.0 56916692.0 \n", "2013 2321.20 492086.83 96012.0 14160.0 71937602.0 \n", "\n", " carrier_delay weather_delay nas_delay security_delay \\\n", "year \n", "2009 16952697.0 2923083.0 18457683.0 72335.0 \n", "2010 19217505.0 2785212.0 16229118.0 107410.0 \n", "2011 18553241.0 2558373.0 15303210.0 81353.0 \n", "2012 18165456.0 2279810.0 12828822.0 73052.0 \n", "2013 21136897.0 2974153.0 17426866.0 103651.0 \n", "\n", " late_aircraft_delay \n", "year \n", "2009 21988030.0 \n", "2010 24918253.0 \n", "2011 25179765.0 \n", "2012 23569552.0 \n", "2013 30296035.0 " ] }, "execution_count": 118, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Grouping the data by year:\n", "year_df = maindf.set_index('year').groupby(level=0).sum()\n", "year_df.head()" ] }, { "cell_type": "code", "execution_count": 119, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "mode": "lines+markers", "text": [ 5917946, 6450117, 6085281, 6096762, 6369482, 5819811, 5819079, 5617658, 5674621, 7213446, 1117160 ], "type": "scatter", "uid": "4e5c78a5-fa24-4483-ad42-9d92658f3a9c", "x": [ 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 ], "y": [ 5917946, 6450117, 6085281, 6096762, 6369482, 5819811, 5819079, 5617658, 5674621, 7213446, 1117160 ] } ], "layout": { "showlegend": true, "title": { "text": "Total No. of Flights By Year - 2009-2019" }, "xaxis": { "showgrid": true, "ticklen": 5, "title": { "text": "Year" } }, "yaxis": { "rangemode": "tozero", "title": { "text": "Avg. Delay per fligh in minutes" } } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "#Plotting the number of flights\n", "trace = go.Scatter(x= list(year_df.index), \n", " y= list(year_df['arr_flights']), \n", " text = year_df['arr_flights'], mode = 'lines+markers')\n", " \n", "data = [trace]\n", "layout = dict(title = 'Total No. of Flights By Year - 2009-2019',\n", " xaxis= dict(title= 'Year',ticklen= 5,showgrid=True),\n", " yaxis = dict(title= 'Avg. Delay per fligh in minutes', rangemode= 'tozero'),\n", " showlegend=True\n", " )\n", "\n", "fig = dict(data = data, layout = layout)\n", "\n", "iplot(fig)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Well, in 2019, we're only provided the data till February, which is why we there is such a drop in the numbers. Let's get rid of 2019" ] }, { "cell_type": "code", "execution_count": 120, "metadata": {}, "outputs": [], "source": [ "new_year_df = year_df.iloc[:-1, :]" ] }, { "cell_type": "code", "execution_count": 121, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
montharr_flightsarr_del15carrier_ctweather_ctnas_ctsecurity_ctlate_aircraft_ctarr_cancelledarr_divertedarr_delaycarrier_delayweather_delaynas_delaysecurity_delaylate_aircraft_delay
year
20091131475917946.01109632.0296652.2536781.26407857.512118.93366223.9676947.014200.060393828.016952697.02923083.018457683.072335.021988030.0
20101151156450117.01174884.0339084.4435854.04376616.893057.76420272.65113255.015474.063257498.019217505.02785212.016229118.0107410.024918253.0
20111015386085281.01109872.0313296.5430963.04352694.642318.39410600.62115978.014399.061675942.018553241.02558373.015303210.081353.025179765.0
2012935106096762.01015158.0302680.2228799.46300169.191980.71381529.3978862.012519.056916692.018165456.02279810.012828822.073052.023569552.0
20131048376369482.01269277.0353206.7536817.01384847.912321.20492086.8396012.014160.071937602.021136897.02974153.017426866.0103651.030296035.0
2014909275819811.01240528.0356587.9435035.38368634.531641.06478629.06126984.014449.070316961.021259409.02988669.016519549.065350.029483984.0
2015867685819079.01063439.0323453.8636036.71316684.491949.72385314.9489884.015187.062651867.020172956.03100233.014335762.080985.024961931.0
2016797645617658.0964239.0283191.7128658.42301437.861811.80349140.3665861.013652.059850360.019533337.02606083.014170617.081925.023458398.0
2017817245674621.01029474.0285058.6228580.50330589.891801.53383442.5182693.012530.065816682.020516702.02799759.016500787.094170.025905070.0
20181324717213446.01352710.0373477.3147408.01438765.752518.70490540.94116584.017859.087540080.026316981.04919075.021488435.0126531.034689058.0
\n", "
" ], "text/plain": [ " month arr_flights arr_del15 carrier_ct weather_ct nas_ct \\\n", "year \n", "2009 113147 5917946.0 1109632.0 296652.25 36781.26 407857.51 \n", "2010 115115 6450117.0 1174884.0 339084.44 35854.04 376616.89 \n", "2011 101538 6085281.0 1109872.0 313296.54 30963.04 352694.64 \n", "2012 93510 6096762.0 1015158.0 302680.22 28799.46 300169.19 \n", "2013 104837 6369482.0 1269277.0 353206.75 36817.01 384847.91 \n", "2014 90927 5819811.0 1240528.0 356587.94 35035.38 368634.53 \n", "2015 86768 5819079.0 1063439.0 323453.86 36036.71 316684.49 \n", "2016 79764 5617658.0 964239.0 283191.71 28658.42 301437.86 \n", "2017 81724 5674621.0 1029474.0 285058.62 28580.50 330589.89 \n", "2018 132471 7213446.0 1352710.0 373477.31 47408.01 438765.75 \n", "\n", " security_ct late_aircraft_ct arr_cancelled arr_diverted arr_delay \\\n", "year \n", "2009 2118.93 366223.96 76947.0 14200.0 60393828.0 \n", "2010 3057.76 420272.65 113255.0 15474.0 63257498.0 \n", "2011 2318.39 410600.62 115978.0 14399.0 61675942.0 \n", "2012 1980.71 381529.39 78862.0 12519.0 56916692.0 \n", "2013 2321.20 492086.83 96012.0 14160.0 71937602.0 \n", "2014 1641.06 478629.06 126984.0 14449.0 70316961.0 \n", "2015 1949.72 385314.94 89884.0 15187.0 62651867.0 \n", "2016 1811.80 349140.36 65861.0 13652.0 59850360.0 \n", "2017 1801.53 383442.51 82693.0 12530.0 65816682.0 \n", "2018 2518.70 490540.94 116584.0 17859.0 87540080.0 \n", "\n", " carrier_delay weather_delay nas_delay security_delay \\\n", "year \n", "2009 16952697.0 2923083.0 18457683.0 72335.0 \n", "2010 19217505.0 2785212.0 16229118.0 107410.0 \n", "2011 18553241.0 2558373.0 15303210.0 81353.0 \n", "2012 18165456.0 2279810.0 12828822.0 73052.0 \n", "2013 21136897.0 2974153.0 17426866.0 103651.0 \n", "2014 21259409.0 2988669.0 16519549.0 65350.0 \n", "2015 20172956.0 3100233.0 14335762.0 80985.0 \n", "2016 19533337.0 2606083.0 14170617.0 81925.0 \n", "2017 20516702.0 2799759.0 16500787.0 94170.0 \n", "2018 26316981.0 4919075.0 21488435.0 126531.0 \n", "\n", " late_aircraft_delay \n", "year \n", "2009 21988030.0 \n", "2010 24918253.0 \n", "2011 25179765.0 \n", "2012 23569552.0 \n", "2013 30296035.0 \n", "2014 29483984.0 \n", "2015 24961931.0 \n", "2016 23458398.0 \n", "2017 25905070.0 \n", "2018 34689058.0 " ] }, "execution_count": 121, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_year_df" ] }, { "cell_type": "code", "execution_count": 122, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "mode": "lines+markers", "text": [ 5917946, 6450117, 6085281, 6096762, 6369482, 5819811, 5819079, 5617658, 5674621, 7213446 ], "type": "scatter", "uid": "4dbae4b2-62fb-466c-9ea3-c934b574dbd8", "x": [ 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 ], "y": [ 5917946, 6450117, 6085281, 6096762, 6369482, 5819811, 5819079, 5617658, 5674621, 7213446 ] } ], "layout": { "showlegend": true, "title": { "text": "Total No. of Flights By Year - 2009-2018*
[2019 is avoided as Data only provided until February]" }, "xaxis": { "showgrid": true, "ticklen": 5, "title": { "text": "Year" } }, "yaxis": { "rangemode": "tozero", "title": { "text": "Total No. Of Flights" } } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "#Plot\n", "trace = go.Scatter(x= list(new_year_df.index), \n", " y= list(new_year_df['arr_flights']), \n", " text = new_year_df['arr_flights'], mode = 'lines+markers')\n", " \n", "data = [trace]\n", "layout = dict(title = 'Total No. of Flights By Year - 2009-2018*
[2019 is avoided as Data only provided until February]',\n", " xaxis= dict(title= 'Year',ticklen= 5,showgrid=True),\n", " yaxis = dict(title= 'Total No. Of Flights', rangemode= 'tozero'),\n", " showlegend=True\n", " )\n", "\n", "fig = dict(data = data, layout = layout)\n", "\n", "iplot(fig)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### we can see that the total number of flights in 2018 is so much higher than that of 2017, the latter appearing pretty close to the average of all the previous years combined. [at least, visually]" ] }, { "cell_type": "code", "execution_count": 200, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "name": "2017", "type": "bar", "uid": "c2f8a54f-565b-4961-ab49-0d1295749dc7", "x": [ "Delayed Flights", "Carrier Del.", "NAS Del.", "Late Aircraft Del." ], "y": [ 1029474, 285058.6199999999, 330589.8899999984, 383442.5100000003 ] }, { "name": "2018", "type": "bar", "uid": "e82e375a-4589-4dc7-9728-2b5cb6def019", "x": [ "Delayed Flights", "Carrier Del.", "NAS Del.", "Late Aircraft Del." ], "y": [ 1352710, 373477.30999999854, 438765.7499999992, 490540.9399999993 ] } ], "layout": { "barmode": "group", "title": { "text": "Comparison of Delayed Flights and causes - 2017 & 2018" }, "yaxis": { "title": { "text": "No. of Flights" } } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "#Let's do a visual comparison of delayed flights in 2017 and 2018\n", "stat = ['Delayed Flights', 'Carrier Del.', 'NAS Del.', 'Late Aircraft Del.']\n", "fig = go.Figure(data=[\n", " go.Bar(name='2017', x=stat, y=[new_year_df.loc[2017][2], new_year_df.loc[2017][3], new_year_df.loc[2017][5], new_year_df.loc[2017][7]]),\n", " go.Bar(name='2018', x=stat, y= [new_year_df.loc[2018][2], new_year_df.loc[2018][3], new_year_df.loc[2018][5], new_year_df.loc[2018][7]])\n", "])\n", "\n", "fig.layout.update(barmode='group', title = 'Comparison of Delayed Flights and causes - 2017 & 2018',\n", " yaxis = dict(title = 'No. of Flights'))\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###### Let's take the average of the years of 2009-2017 and compare that with 2018's numbers" ] }, { "cell_type": "code", "execution_count": 124, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
montharr_flightsarr_del15carrier_ctweather_ctnas_ctsecurity_ctlate_aircraft_ctarr_cancelledarr_divertedarr_delaycarrier_delayweather_delaynas_delaysecurity_delaylate_aircraft_delay
year
20091131475917946.01109632.0296652.2536781.26407857.512118.93366223.9676947.014200.060393828.016952697.02923083.018457683.072335.021988030.0
20101151156450117.01174884.0339084.4435854.04376616.893057.76420272.65113255.015474.063257498.019217505.02785212.016229118.0107410.024918253.0
20111015386085281.01109872.0313296.5430963.04352694.642318.39410600.62115978.014399.061675942.018553241.02558373.015303210.081353.025179765.0
2012935106096762.01015158.0302680.2228799.46300169.191980.71381529.3978862.012519.056916692.018165456.02279810.012828822.073052.023569552.0
20131048376369482.01269277.0353206.7536817.01384847.912321.20492086.8396012.014160.071937602.021136897.02974153.017426866.0103651.030296035.0
2014909275819811.01240528.0356587.9435035.38368634.531641.06478629.06126984.014449.070316961.021259409.02988669.016519549.065350.029483984.0
2015867685819079.01063439.0323453.8636036.71316684.491949.72385314.9489884.015187.062651867.020172956.03100233.014335762.080985.024961931.0
2016797645617658.0964239.0283191.7128658.42301437.861811.80349140.3665861.013652.059850360.019533337.02606083.014170617.081925.023458398.0
2017817245674621.01029474.0285058.6228580.50330589.891801.53383442.5182693.012530.065816682.020516702.02799759.016500787.094170.025905070.0
20181324717213446.01352710.0373477.3147408.01438765.752518.70490540.94116584.017859.087540080.026316981.04919075.021488435.0126531.034689058.0
\n", "
" ], "text/plain": [ " month arr_flights arr_del15 carrier_ct weather_ct nas_ct \\\n", "year \n", "2009 113147 5917946.0 1109632.0 296652.25 36781.26 407857.51 \n", "2010 115115 6450117.0 1174884.0 339084.44 35854.04 376616.89 \n", "2011 101538 6085281.0 1109872.0 313296.54 30963.04 352694.64 \n", "2012 93510 6096762.0 1015158.0 302680.22 28799.46 300169.19 \n", "2013 104837 6369482.0 1269277.0 353206.75 36817.01 384847.91 \n", "2014 90927 5819811.0 1240528.0 356587.94 35035.38 368634.53 \n", "2015 86768 5819079.0 1063439.0 323453.86 36036.71 316684.49 \n", "2016 79764 5617658.0 964239.0 283191.71 28658.42 301437.86 \n", "2017 81724 5674621.0 1029474.0 285058.62 28580.50 330589.89 \n", "2018 132471 7213446.0 1352710.0 373477.31 47408.01 438765.75 \n", "\n", " security_ct late_aircraft_ct arr_cancelled arr_diverted arr_delay \\\n", "year \n", "2009 2118.93 366223.96 76947.0 14200.0 60393828.0 \n", "2010 3057.76 420272.65 113255.0 15474.0 63257498.0 \n", "2011 2318.39 410600.62 115978.0 14399.0 61675942.0 \n", "2012 1980.71 381529.39 78862.0 12519.0 56916692.0 \n", "2013 2321.20 492086.83 96012.0 14160.0 71937602.0 \n", "2014 1641.06 478629.06 126984.0 14449.0 70316961.0 \n", "2015 1949.72 385314.94 89884.0 15187.0 62651867.0 \n", "2016 1811.80 349140.36 65861.0 13652.0 59850360.0 \n", "2017 1801.53 383442.51 82693.0 12530.0 65816682.0 \n", "2018 2518.70 490540.94 116584.0 17859.0 87540080.0 \n", "\n", " carrier_delay weather_delay nas_delay security_delay \\\n", "year \n", "2009 16952697.0 2923083.0 18457683.0 72335.0 \n", "2010 19217505.0 2785212.0 16229118.0 107410.0 \n", "2011 18553241.0 2558373.0 15303210.0 81353.0 \n", "2012 18165456.0 2279810.0 12828822.0 73052.0 \n", "2013 21136897.0 2974153.0 17426866.0 103651.0 \n", "2014 21259409.0 2988669.0 16519549.0 65350.0 \n", "2015 20172956.0 3100233.0 14335762.0 80985.0 \n", "2016 19533337.0 2606083.0 14170617.0 81925.0 \n", "2017 20516702.0 2799759.0 16500787.0 94170.0 \n", "2018 26316981.0 4919075.0 21488435.0 126531.0 \n", "\n", " late_aircraft_delay \n", "year \n", "2009 21988030.0 \n", "2010 24918253.0 \n", "2011 25179765.0 \n", "2012 23569552.0 \n", "2013 30296035.0 \n", "2014 29483984.0 \n", "2015 24961931.0 \n", "2016 23458398.0 \n", "2017 25905070.0 \n", "2018 34689058.0 " ] }, "execution_count": 124, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_year_df" ] }, { "cell_type": "code", "execution_count": 199, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "name": "Avg. of 2009-2017", "type": "bar", "uid": "4718681f-0dfb-469d-bb72-56f85b80d35d", "x": [ "Delayed Flights", "Carrier Del.", "NAS Del.", "Late Aircraft Del." ], "y": [ 1108500.3333333333, 317023.592222222, 348836.98999999836, 407471.1466666664 ] }, { "name": "2018", "type": "bar", "uid": "32d796ca-8905-4836-90e5-ab588402653d", "x": [ "Delayed Flights", "Carrier Del.", "NAS Del.", "Late Aircraft Del." ], "y": [ 1352710, 373477.30999999854, 438765.7499999992, 490540.9399999993 ] } ], "layout": { "bargap": 0.45, "barmode": "group", "title": { "text": "Comparison of Delayed Flights and causes - Avg. of 2009-2017 & 2018
(Hover for details)" }, "xaxis": { "tickangle": 0 }, "yaxis": { "title": { "text": "No. of Flights" } } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "#Let's do a visual comparison of average delayed flights from 2009-2017 vs the delayed flights of 2018\n", "stat = ['Delayed Flights', 'Carrier Del.', 'NAS Del.', 'Late Aircraft Del.']\n", "fig = go.Figure(data=[\n", " go.Bar(name='Avg. of 2009-2017', x=stat, y=[np.mean(new_year_df.iloc[:-1, :]).loc['arr_del15'],\n", " np.mean(new_year_df.iloc[:-1, :]).loc['carrier_ct'], \n", " np.mean(new_year_df.iloc[:-1, :]).loc['nas_ct'],\n", " np.mean(new_year_df.iloc[:-1, :]).loc['late_aircraft_ct']]), \n", " go.Bar(name='2018', x=stat, y= [new_year_df.loc[2018][2], new_year_df.loc[2018][3], new_year_df.loc[2018][5], new_year_df.loc[2018][7]])\n", "])\n", "\n", "fig.layout.update(barmode='group', title = 'Comparison of Delayed Flights and causes - Avg. of 2009-2017 & 2018
(Hover for details)',\n", " yaxis = dict(title = 'No. of Flights'), \n", " xaxis_tickangle = 0, bargap = 0.45)\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Which months should we fly to avoid significant delays? \n", "\n", "For this, we will have to group by Month - pretty simple. \n", "We will again be calculating the Delay in minutes per flight in that month. As that seems to be a reasonable statistic" ] }, { "cell_type": "code", "execution_count": 126, "metadata": {}, "outputs": [], "source": [ "month_total_delay = maindf.set_index(' month').iloc[:, list(maindf.set_index(' month').columns).index(' arr_delay')].groupby(level = 0).sum()\n" ] }, { "cell_type": "code", "execution_count": 127, "metadata": {}, "outputs": [], "source": [ "month_total_arrivals = maindf.set_index(' month').iloc[:, list(maindf.set_index(' month').columns).index('arr_flights')].groupby(level = 0).sum()" ] }, { "cell_type": "code", "execution_count": 128, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Total DelayTotal No. of FlightsDelay/Flight
month
155992069.05003725.011.190077
255421731.05109873.010.846009
354102640.05295087.010.217517
452453539.05110413.010.264051
557717664.05255897.010.981506
673834338.05331553.013.848561
775536793.05513319.013.700784
864681554.05454172.011.859097
940278757.04959221.08.121993
1043951145.05178013.08.488033
1139010669.04921185.07.927088
1262791162.05048905.012.436590
\n", "
" ], "text/plain": [ " Total Delay Total No. of Flights Delay/Flight\n", " month \n", "1 55992069.0 5003725.0 11.190077\n", "2 55421731.0 5109873.0 10.846009\n", "3 54102640.0 5295087.0 10.217517\n", "4 52453539.0 5110413.0 10.264051\n", "5 57717664.0 5255897.0 10.981506\n", "6 73834338.0 5331553.0 13.848561\n", "7 75536793.0 5513319.0 13.700784\n", "8 64681554.0 5454172.0 11.859097\n", "9 40278757.0 4959221.0 8.121993\n", "10 43951145.0 5178013.0 8.488033\n", "11 39010669.0 4921185.0 7.927088\n", "12 62791162.0 5048905.0 12.436590" ] }, "execution_count": 128, "metadata": {}, "output_type": "execute_result" } ], "source": [ "month_df = pd.DataFrame({'Total Delay': month_total_delay, 'Total No. of Flights': month_total_arrivals})\n", "month_df['Delay/Flight'] = month_df['Total Delay']/month_df['Total No. of Flights']\n", "\n", "month_df" ] }, { "cell_type": "code", "execution_count": 129, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Total DelayTotal No. of FlightsDelay/FlightMonth
month
155992069.05003725.011.190077January
255421731.05109873.010.846009February
354102640.05295087.010.217517March
452453539.05110413.010.264051April
557717664.05255897.010.981506May
673834338.05331553.013.848561June
775536793.05513319.013.700784July
864681554.05454172.011.859097August
940278757.04959221.08.121993September
1043951145.05178013.08.488033October
1139010669.04921185.07.927088November
1262791162.05048905.012.436590December
\n", "
" ], "text/plain": [ " Total Delay Total No. of Flights Delay/Flight Month\n", " month \n", "1 55992069.0 5003725.0 11.190077 January\n", "2 55421731.0 5109873.0 10.846009 February\n", "3 54102640.0 5295087.0 10.217517 March\n", "4 52453539.0 5110413.0 10.264051 April\n", "5 57717664.0 5255897.0 10.981506 May\n", "6 73834338.0 5331553.0 13.848561 June\n", "7 75536793.0 5513319.0 13.700784 July\n", "8 64681554.0 5454172.0 11.859097 August\n", "9 40278757.0 4959221.0 8.121993 September\n", "10 43951145.0 5178013.0 8.488033 October\n", "11 39010669.0 4921185.0 7.927088 November\n", "12 62791162.0 5048905.0 12.436590 December" ] }, "execution_count": 129, "metadata": {}, "output_type": "execute_result" } ], "source": [ "month_list = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', \n", " 'November','December']\n", "month_df['Month'] = month_list \n", "month_df" ] }, { "cell_type": "code", "execution_count": 130, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "marker": { "color": [ "lightslategray", "lightslategray", "lightslategray", "lightslategray", "lightslategray", "lightslategray", "lightslategray", "lightslategray", "lightslategray", "lightslategray", "crimson", "lightslategray" ] }, "text": [ 11.19, 10.85, 10.22, 10.26, 10.98, 13.85, 13.7, 11.86, 8.12, 8.49, 7.93, 12.44 ], "textposition": "auto", "type": "bar", "uid": "4237e6b4-ae64-4990-b374-2dc3f2906d23", "x": [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], "y": [ 11.190077192491593, 10.846009480079054, 10.217516728242614, 10.26405087025256, 10.981505916116697, 13.848561197834853, 13.700784046778356, 11.85909685283119, 8.121992748457872, 8.488032957816058, 7.927088495961846, 12.436590112113418 ] } ], "layout": { "title": { "text": "Average Delay per Flight by month" }, "xaxis": { "title": { "text": "Month" } }, "yaxis": { "title": { "text": "Avg. Delay per Flight in minutes" } } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "lowest_index = np.argmin(month_df['Delay/Flight']) - 1 #since month_df's index starts from 1 and not 0\n", "colors = ['lightslategray',] * 12\n", "colors[lowest_index] = 'crimson'\n", "\n", "data= go.Bar(x = month_df.Month, \n", " y = month_df['Delay/Flight'],\n", " text=round(month_df['Delay/Flight'], 2),\n", " textposition = 'auto', \n", " marker_color =colors)\n", "\n", "\n", "\n", "fig = go.Figure()\n", "fig.add_trace(data)\n", "fig.layout.update(title = 'Average Delay per Flight by month', \n", " xaxis =dict(title='Month'), \n", " yaxis= dict(title='Avg. Delay per Flight in minutes'))\n", "iplot(fig)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "Thus September, October and November (with November being the best) are the best months to travel in. And one should avoid travelling in June, July if they're looking for least delays. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### % of Flights Delayed (>15 mins) by Airport. Map Plot" ] }, { "cell_type": "code", "execution_count": 131, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
yearmonthcarriercarrier_nameairportairport_namearr_flightsarr_del15carrier_ctweather_ct...security_ctlate_aircraft_ctarr_cancelledarr_divertedarr_delaycarrier_delayweather_delaynas_delaysecurity_delaylate_aircraft_delay
0200911ASAlaska Airlines Inc.BRWBarrow, AK: Wiley Post/Will Rogers Memorial65.014.03.611.06...0.06.190.01.0920.0592.034.078.00.0216.0
1200911ASAlaska Airlines Inc.BURBurbank, CA: Bob Hope85.05.01.000.00...0.00.980.00.0134.025.00.070.00.039.0
2200911ASAlaska Airlines Inc.CDVCordova, AK: Merle K Mudhole Smith58.08.02.041.00...0.02.964.02.0586.0174.037.062.00.0313.0
3200911ASAlaska Airlines Inc.DCAWashington, DC: Ronald Reagan Washington National88.011.01.990.00...0.00.000.00.0266.065.00.0201.00.00.0
4200911ASAlaska Airlines Inc.DENDenver, CO: Denver International123.05.03.470.00...0.00.000.00.081.057.00.024.00.00.0
5200911ASAlaska Airlines Inc.DFWDallas/Fort Worth, TX: Dallas/Fort Worth Inter...66.06.01.280.69...0.00.000.00.0176.064.011.0101.00.00.0
6200911ASAlaska Airlines Inc.EWRNewark, NJ: Newark Liberty International59.010.00.240.00...0.00.560.00.0553.08.00.0526.00.019.0
7200911ASAlaska Airlines Inc.FAIFairbanks, AK: Fairbanks International299.041.018.351.82...0.08.702.00.01910.0707.0114.0386.00.0703.0
8200911ASAlaska Airlines Inc.GEGSpokane, WA: Spokane International86.00.00.000.00...0.00.001.00.00.00.00.00.00.00.0
9200911ASAlaska Airlines Inc.HNLHonolulu, HI: Daniel K Inouye International85.018.01.341.46...0.00.000.00.0547.085.089.0373.00.00.0
\n", "

10 rows × 21 columns

\n", "
" ], "text/plain": [ " year month carrier carrier_name airport \\\n", "0 2009 11 AS Alaska Airlines Inc. BRW \n", "1 2009 11 AS Alaska Airlines Inc. BUR \n", "2 2009 11 AS Alaska Airlines Inc. CDV \n", "3 2009 11 AS Alaska Airlines Inc. DCA \n", "4 2009 11 AS Alaska Airlines Inc. DEN \n", "5 2009 11 AS Alaska Airlines Inc. DFW \n", "6 2009 11 AS Alaska Airlines Inc. EWR \n", "7 2009 11 AS Alaska Airlines Inc. FAI \n", "8 2009 11 AS Alaska Airlines Inc. GEG \n", "9 2009 11 AS Alaska Airlines Inc. HNL \n", "\n", " airport_name arr_flights arr_del15 \\\n", "0 Barrow, AK: Wiley Post/Will Rogers Memorial 65.0 14.0 \n", "1 Burbank, CA: Bob Hope 85.0 5.0 \n", "2 Cordova, AK: Merle K Mudhole Smith 58.0 8.0 \n", "3 Washington, DC: Ronald Reagan Washington National 88.0 11.0 \n", "4 Denver, CO: Denver International 123.0 5.0 \n", "5 Dallas/Fort Worth, TX: Dallas/Fort Worth Inter... 66.0 6.0 \n", "6 Newark, NJ: Newark Liberty International 59.0 10.0 \n", "7 Fairbanks, AK: Fairbanks International 299.0 41.0 \n", "8 Spokane, WA: Spokane International 86.0 0.0 \n", "9 Honolulu, HI: Daniel K Inouye International 85.0 18.0 \n", "\n", " carrier_ct weather_ct ... security_ct late_aircraft_ct arr_cancelled \\\n", "0 3.61 1.06 ... 0.0 6.19 0.0 \n", "1 1.00 0.00 ... 0.0 0.98 0.0 \n", "2 2.04 1.00 ... 0.0 2.96 4.0 \n", "3 1.99 0.00 ... 0.0 0.00 0.0 \n", "4 3.47 0.00 ... 0.0 0.00 0.0 \n", "5 1.28 0.69 ... 0.0 0.00 0.0 \n", "6 0.24 0.00 ... 0.0 0.56 0.0 \n", "7 18.35 1.82 ... 0.0 8.70 2.0 \n", "8 0.00 0.00 ... 0.0 0.00 1.0 \n", "9 1.34 1.46 ... 0.0 0.00 0.0 \n", "\n", " arr_diverted arr_delay carrier_delay weather_delay nas_delay \\\n", "0 1.0 920.0 592.0 34.0 78.0 \n", "1 0.0 134.0 25.0 0.0 70.0 \n", "2 2.0 586.0 174.0 37.0 62.0 \n", "3 0.0 266.0 65.0 0.0 201.0 \n", "4 0.0 81.0 57.0 0.0 24.0 \n", "5 0.0 176.0 64.0 11.0 101.0 \n", "6 0.0 553.0 8.0 0.0 526.0 \n", "7 0.0 1910.0 707.0 114.0 386.0 \n", "8 0.0 0.0 0.0 0.0 0.0 \n", "9 0.0 547.0 85.0 89.0 373.0 \n", "\n", " security_delay late_aircraft_delay \n", "0 0.0 216.0 \n", "1 0.0 39.0 \n", "2 0.0 313.0 \n", "3 0.0 0.0 \n", "4 0.0 0.0 \n", "5 0.0 0.0 \n", "6 0.0 19.0 \n", "7 0.0 703.0 \n", "8 0.0 0.0 \n", "9 0.0 0.0 \n", "\n", "[10 rows x 21 columns]" ] }, "execution_count": 131, "metadata": {}, "output_type": "execute_result" } ], "source": [ " \n", "maindf.head(10)" ] }, { "cell_type": "code", "execution_count": 132, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(155710, 21)" ] }, "execution_count": 132, "metadata": {}, "output_type": "execute_result" } ], "source": [ "maindf.shape" ] }, { "cell_type": "code", "execution_count": 133, "metadata": {}, "outputs": [], "source": [ "choro_df = maindf.set_index('airport').groupby(level=0).sum()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##### I found a data set containing co-ordinates and more info of airports. But these are only 221 airports as compared to 381 airports. However, it's very much likely that these 221 airports are rather, the main ones. " ] }, { "cell_type": "code", "execution_count": 134, "metadata": {}, "outputs": [], "source": [ "#Here is a data set containing the latitudes and longitudes of Airports\n", "\n", "df_tp = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/2011_february_us_airport_traffic.csv')" ] }, { "cell_type": "code", "execution_count": 135, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
iataairportcitystatecountrylatlongcnt
0ORDChicago O'Hare InternationalChicagoILUSA41.979595-87.90446425129
1ATLWilliam B Hartsfield-Atlanta IntlAtlantaGAUSA33.640444-84.42694421925
2DFWDallas-Fort Worth InternationalDallas-Fort WorthTXUSA32.895951-97.03720020662
3PHXPhoenix Sky Harbor InternationalPhoenixAZUSA33.434167-112.00805617290
4DENDenver IntlDenverCOUSA39.858408-104.66700213781
\n", "
" ], "text/plain": [ " iata airport city state country \\\n", "0 ORD Chicago O'Hare International Chicago IL USA \n", "1 ATL William B Hartsfield-Atlanta Intl Atlanta GA USA \n", "2 DFW Dallas-Fort Worth International Dallas-Fort Worth TX USA \n", "3 PHX Phoenix Sky Harbor International Phoenix AZ USA \n", "4 DEN Denver Intl Denver CO USA \n", "\n", " lat long cnt \n", "0 41.979595 -87.904464 25129 \n", "1 33.640444 -84.426944 21925 \n", "2 32.895951 -97.037200 20662 \n", "3 33.434167 -112.008056 17290 \n", "4 39.858408 -104.667002 13781 " ] }, "execution_count": 135, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_tp.head()" ] }, { "cell_type": "code", "execution_count": 136, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
yearmontharr_flightsarr_del15carrier_ctweather_ctnas_ctsecurity_ctlate_aircraft_ctarr_cancelledarr_divertedarr_delaycarrier_delayweather_delaynas_delaysecurity_delaylate_aircraft_delay
airport
ABE998462318931126.05976.02339.05205.871463.035.401962.63735.0102.0371118.0156117.017890.063970.0186.0132955.0
ABI23555175120361.04189.01623.86475.66704.1410.461374.79559.020.0217038.071571.037452.028333.0366.079316.0
ABQ23499157570270269.051839.018862.461112.538667.76141.1623055.192011.0398.02543213.0893157.088056.0308377.04928.01248695.0
ABR1732945695190.0532.0189.7624.11151.000.00167.1781.012.038801.015362.07415.05375.00.010649.0
ABY2456697809758.01876.0751.8062.73325.772.00733.72120.026.0116642.049808.09362.014859.0139.042474.0
\n", "
" ], "text/plain": [ " year month arr_flights arr_del15 carrier_ct weather_ct \\\n", "airport \n", "ABE 998462 3189 31126.0 5976.0 2339.05 205.87 \n", "ABI 235551 751 20361.0 4189.0 1623.86 475.66 \n", "ABQ 2349915 7570 270269.0 51839.0 18862.46 1112.53 \n", "ABR 173294 569 5190.0 532.0 189.76 24.11 \n", "ABY 245669 780 9758.0 1876.0 751.80 62.73 \n", "\n", " nas_ct security_ct late_aircraft_ct arr_cancelled arr_diverted \\\n", "airport \n", "ABE 1463.03 5.40 1962.63 735.0 102.0 \n", "ABI 704.14 10.46 1374.79 559.0 20.0 \n", "ABQ 8667.76 141.16 23055.19 2011.0 398.0 \n", "ABR 151.00 0.00 167.17 81.0 12.0 \n", "ABY 325.77 2.00 733.72 120.0 26.0 \n", "\n", " arr_delay carrier_delay weather_delay nas_delay security_delay \\\n", "airport \n", "ABE 371118.0 156117.0 17890.0 63970.0 186.0 \n", "ABI 217038.0 71571.0 37452.0 28333.0 366.0 \n", "ABQ 2543213.0 893157.0 88056.0 308377.0 4928.0 \n", "ABR 38801.0 15362.0 7415.0 5375.0 0.0 \n", "ABY 116642.0 49808.0 9362.0 14859.0 139.0 \n", "\n", " late_aircraft_delay \n", "airport \n", "ABE 132955.0 \n", "ABI 79316.0 \n", "ABQ 1248695.0 \n", "ABR 10649.0 \n", "ABY 42474.0 " ] }, "execution_count": 136, "metadata": {}, "output_type": "execute_result" } ], "source": [ "choro_df.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " \n", "We need to merge these dataframes. " ] }, { "cell_type": "code", "execution_count": 137, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
yearmontharr_flightsarr_del15carrier_ctweather_ctnas_ctsecurity_ctlate_aircraft_ctarr_cancelled...security_delaylate_aircraft_delayiataairportcitystatecountrylatlongcnt
203998462318931126.05976.02339.05205.871463.035.401962.63735.0...186.0132955.0ABELehigh Valley InternationalAllentownPAUSA40.652363-75.44040260
12623555175120361.04189.01623.86475.66704.1410.461374.79559.0...366.079316.0ABIAbilene RegionalAbileneTXUSA32.411320-99.681897382
6423499157570270269.051839.018862.461112.538667.76141.1623055.192011.0...4928.01248695.0ABQAlbuquerque InternationalAlbuquerqueNMUSA35.040222-106.6091941258
17624364978225263.06285.01333.74199.48913.700.913837.151295.0...16.0265217.0ACVArcataArcata/EurekaCAUSA40.978115-124.108619144
167571721184032882.06139.02367.37292.241333.808.982136.65713.0...413.0125965.0AEXAlexandria InternationalAlexandriaLAUSA31.327372-92.548556168
\n", "

5 rows × 25 columns

\n", "
" ], "text/plain": [ " year month arr_flights arr_del15 carrier_ct weather_ct \\\n", "203 998462 3189 31126.0 5976.0 2339.05 205.87 \n", "126 235551 751 20361.0 4189.0 1623.86 475.66 \n", "64 2349915 7570 270269.0 51839.0 18862.46 1112.53 \n", "176 243649 782 25263.0 6285.0 1333.74 199.48 \n", "167 571721 1840 32882.0 6139.0 2367.37 292.24 \n", "\n", " nas_ct security_ct late_aircraft_ct arr_cancelled ... \\\n", "203 1463.03 5.40 1962.63 735.0 ... \n", "126 704.14 10.46 1374.79 559.0 ... \n", "64 8667.76 141.16 23055.19 2011.0 ... \n", "176 913.70 0.91 3837.15 1295.0 ... \n", "167 1333.80 8.98 2136.65 713.0 ... \n", "\n", " security_delay late_aircraft_delay iata airport \\\n", "203 186.0 132955.0 ABE Lehigh Valley International \n", "126 366.0 79316.0 ABI Abilene Regional \n", "64 4928.0 1248695.0 ABQ Albuquerque International \n", "176 16.0 265217.0 ACV Arcata \n", "167 413.0 125965.0 AEX Alexandria International \n", "\n", " city state country lat long cnt \n", "203 Allentown PA USA 40.652363 -75.440402 60 \n", "126 Abilene TX USA 32.411320 -99.681897 382 \n", "64 Albuquerque NM USA 35.040222 -106.609194 1258 \n", "176 Arcata/Eureka CA USA 40.978115 -124.108619 144 \n", "167 Alexandria LA USA 31.327372 -92.548556 168 \n", "\n", "[5 rows x 25 columns]" ] }, "execution_count": 137, "metadata": {}, "output_type": "execute_result" } ], "source": [ "merged_df = pd.merge(choro_df, df_tp, how='inner', left_index = True, right_on = 'iata') #merge on airport\n", "merged_df.head()" ] }, { "cell_type": "code", "execution_count": 138, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
arr_flightsarr_del15carrier_ctweather_ctnas_ctsecurity_ctlate_aircraft_ctarr_cancelledarr_divertedarr_delay...nas_delaysecurity_delaylate_aircraft_delayiataairportcitystatecountrylatlong
20331126.05976.02339.05205.871463.035.401962.63735.0102.0371118.0...63970.0186.0132955.0ABELehigh Valley InternationalAllentownPAUSA40.652363-75.440402
12620361.04189.01623.86475.66704.1410.461374.79559.020.0217038.0...28333.0366.079316.0ABIAbilene RegionalAbileneTXUSA32.411320-99.681897
64270269.051839.018862.461112.538667.76141.1623055.192011.0398.02543213.0...308377.04928.01248695.0ABQAlbuquerque InternationalAlbuquerqueNMUSA35.040222-106.609194
17625263.06285.01333.74199.48913.700.913837.151295.0261.0414526.0...33236.016.0265217.0ACVArcataArcata/EurekaCAUSA40.978115-124.108619
16732882.06139.02367.37292.241333.808.982136.65713.0106.0348355.0...54063.0413.0125965.0AEXAlexandria InternationalAlexandriaLAUSA31.327372-92.548556
18731889.06326.02677.74222.851136.223.762285.29475.060.0388455.0...47079.087.0146011.0AGSBushAugustaGAUSA33.369955-81.964496
198102056.020707.08423.85663.023907.4541.707671.021702.0155.01144355.0...164028.01576.0469889.0ALBAlbany CtyAlbanyNYUSA42.748119-73.802979
9849017.011308.03911.40698.172877.5020.173800.782407.01514.0712832.0...129589.01456.0241399.0ASEAspen-Pitkin Co/SardyAspenCOUSA39.223160-106.868845
13931975.0661494.0151349.5718379.91248613.97603.00242548.0348865.08331.042069206.0...11303992.029836.016113325.0ATLWilliam B Hartsfield-Atlanta IntlAtlantaGAUSA33.640444-84.426944
21138029.07450.02854.37231.921855.384.962503.631160.0107.0451002.0...75527.0144.0159268.0ATWOutagamie County RegionalAppletonWIUSA44.257408-88.519476
\n", "

10 rows × 22 columns

\n", "
" ], "text/plain": [ " arr_flights arr_del15 carrier_ct weather_ct nas_ct security_ct \\\n", "203 31126.0 5976.0 2339.05 205.87 1463.03 5.40 \n", "126 20361.0 4189.0 1623.86 475.66 704.14 10.46 \n", "64 270269.0 51839.0 18862.46 1112.53 8667.76 141.16 \n", "176 25263.0 6285.0 1333.74 199.48 913.70 0.91 \n", "167 32882.0 6139.0 2367.37 292.24 1333.80 8.98 \n", "187 31889.0 6326.0 2677.74 222.85 1136.22 3.76 \n", "198 102056.0 20707.0 8423.85 663.02 3907.45 41.70 \n", "98 49017.0 11308.0 3911.40 698.17 2877.50 20.17 \n", "1 3931975.0 661494.0 151349.57 18379.91 248613.97 603.00 \n", "211 38029.0 7450.0 2854.37 231.92 1855.38 4.96 \n", "\n", " late_aircraft_ct arr_cancelled arr_diverted arr_delay ... \\\n", "203 1962.63 735.0 102.0 371118.0 ... \n", "126 1374.79 559.0 20.0 217038.0 ... \n", "64 23055.19 2011.0 398.0 2543213.0 ... \n", "176 3837.15 1295.0 261.0 414526.0 ... \n", "167 2136.65 713.0 106.0 348355.0 ... \n", "187 2285.29 475.0 60.0 388455.0 ... \n", "198 7671.02 1702.0 155.0 1144355.0 ... \n", "98 3800.78 2407.0 1514.0 712832.0 ... \n", "1 242548.03 48865.0 8331.0 42069206.0 ... \n", "211 2503.63 1160.0 107.0 451002.0 ... \n", "\n", " nas_delay security_delay late_aircraft_delay iata \\\n", "203 63970.0 186.0 132955.0 ABE \n", "126 28333.0 366.0 79316.0 ABI \n", "64 308377.0 4928.0 1248695.0 ABQ \n", "176 33236.0 16.0 265217.0 ACV \n", "167 54063.0 413.0 125965.0 AEX \n", "187 47079.0 87.0 146011.0 AGS \n", "198 164028.0 1576.0 469889.0 ALB \n", "98 129589.0 1456.0 241399.0 ASE \n", "1 11303992.0 29836.0 16113325.0 ATL \n", "211 75527.0 144.0 159268.0 ATW \n", "\n", " airport city state country \\\n", "203 Lehigh Valley International Allentown PA USA \n", "126 Abilene Regional Abilene TX USA \n", "64 Albuquerque International Albuquerque NM USA \n", "176 Arcata Arcata/Eureka CA USA \n", "167 Alexandria International Alexandria LA USA \n", "187 Bush Augusta GA USA \n", "198 Albany Cty Albany NY USA \n", "98 Aspen-Pitkin Co/Sardy Aspen CO USA \n", "1 William B Hartsfield-Atlanta Intl Atlanta GA USA \n", "211 Outagamie County Regional Appleton WI USA \n", "\n", " lat long \n", "203 40.652363 -75.440402 \n", "126 32.411320 -99.681897 \n", "64 35.040222 -106.609194 \n", "176 40.978115 -124.108619 \n", "167 31.327372 -92.548556 \n", "187 33.369955 -81.964496 \n", "198 42.748119 -73.802979 \n", "98 39.223160 -106.868845 \n", "1 33.640444 -84.426944 \n", "211 44.257408 -88.519476 \n", "\n", "[10 rows x 22 columns]" ] }, "execution_count": 138, "metadata": {}, "output_type": "execute_result" } ], "source": [ "merged_df = merged_df.iloc[:,2:-1] #Year and month, and cnt columns, are irrelevant.\n", "merged_df.head(10)" ] }, { "cell_type": "code", "execution_count": 139, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
arr_flightsarr_del15carrier_ctweather_ctnas_ctsecurity_ctlate_aircraft_ctarr_cancelledarr_divertedarr_delay...security_delaylate_aircraft_delayiataairportcitystatecountrylatlong% of Flights15
20331126.05976.02339.05205.871463.035.401962.63735.0102.0371118.0...186.0132955.0ABELehigh Valley InternationalAllentownPAUSA40.652363-75.44040219.20
12620361.04189.01623.86475.66704.1410.461374.79559.020.0217038.0...366.079316.0ABIAbilene RegionalAbileneTXUSA32.411320-99.68189720.57
64270269.051839.018862.461112.538667.76141.1623055.192011.0398.02543213.0...4928.01248695.0ABQAlbuquerque InternationalAlbuquerqueNMUSA35.040222-106.60919419.18
17625263.06285.01333.74199.48913.700.913837.151295.0261.0414526.0...16.0265217.0ACVArcataArcata/EurekaCAUSA40.978115-124.10861924.88
16732882.06139.02367.37292.241333.808.982136.65713.0106.0348355.0...413.0125965.0AEXAlexandria InternationalAlexandriaLAUSA31.327372-92.54855618.67
18731889.06326.02677.74222.851136.223.762285.29475.060.0388455.0...87.0146011.0AGSBushAugustaGAUSA33.369955-81.96449619.84
198102056.020707.08423.85663.023907.4541.707671.021702.0155.01144355.0...1576.0469889.0ALBAlbany CtyAlbanyNYUSA42.748119-73.80297920.29
9849017.011308.03911.40698.172877.5020.173800.782407.01514.0712832.0...1456.0241399.0ASEAspen-Pitkin Co/SardyAspenCOUSA39.223160-106.86884523.07
13931975.0661494.0151349.5718379.91248613.97603.00242548.0348865.08331.042069206.0...29836.016113325.0ATLWilliam B Hartsfield-Atlanta IntlAtlantaGAUSA33.640444-84.42694416.82
21138029.07450.02854.37231.921855.384.962503.631160.0107.0451002.0...144.0159268.0ATWOutagamie County RegionalAppletonWIUSA44.257408-88.51947619.59
\n", "

10 rows × 23 columns

\n", "
" ], "text/plain": [ " arr_flights arr_del15 carrier_ct weather_ct nas_ct security_ct \\\n", "203 31126.0 5976.0 2339.05 205.87 1463.03 5.40 \n", "126 20361.0 4189.0 1623.86 475.66 704.14 10.46 \n", "64 270269.0 51839.0 18862.46 1112.53 8667.76 141.16 \n", "176 25263.0 6285.0 1333.74 199.48 913.70 0.91 \n", "167 32882.0 6139.0 2367.37 292.24 1333.80 8.98 \n", "187 31889.0 6326.0 2677.74 222.85 1136.22 3.76 \n", "198 102056.0 20707.0 8423.85 663.02 3907.45 41.70 \n", "98 49017.0 11308.0 3911.40 698.17 2877.50 20.17 \n", "1 3931975.0 661494.0 151349.57 18379.91 248613.97 603.00 \n", "211 38029.0 7450.0 2854.37 231.92 1855.38 4.96 \n", "\n", " late_aircraft_ct arr_cancelled arr_diverted arr_delay ... \\\n", "203 1962.63 735.0 102.0 371118.0 ... \n", "126 1374.79 559.0 20.0 217038.0 ... \n", "64 23055.19 2011.0 398.0 2543213.0 ... \n", "176 3837.15 1295.0 261.0 414526.0 ... \n", "167 2136.65 713.0 106.0 348355.0 ... \n", "187 2285.29 475.0 60.0 388455.0 ... \n", "198 7671.02 1702.0 155.0 1144355.0 ... \n", "98 3800.78 2407.0 1514.0 712832.0 ... \n", "1 242548.03 48865.0 8331.0 42069206.0 ... \n", "211 2503.63 1160.0 107.0 451002.0 ... \n", "\n", " security_delay late_aircraft_delay iata \\\n", "203 186.0 132955.0 ABE \n", "126 366.0 79316.0 ABI \n", "64 4928.0 1248695.0 ABQ \n", "176 16.0 265217.0 ACV \n", "167 413.0 125965.0 AEX \n", "187 87.0 146011.0 AGS \n", "198 1576.0 469889.0 ALB \n", "98 1456.0 241399.0 ASE \n", "1 29836.0 16113325.0 ATL \n", "211 144.0 159268.0 ATW \n", "\n", " airport city state country \\\n", "203 Lehigh Valley International Allentown PA USA \n", "126 Abilene Regional Abilene TX USA \n", "64 Albuquerque International Albuquerque NM USA \n", "176 Arcata Arcata/Eureka CA USA \n", "167 Alexandria International Alexandria LA USA \n", "187 Bush Augusta GA USA \n", "198 Albany Cty Albany NY USA \n", "98 Aspen-Pitkin Co/Sardy Aspen CO USA \n", "1 William B Hartsfield-Atlanta Intl Atlanta GA USA \n", "211 Outagamie County Regional Appleton WI USA \n", "\n", " lat long % of Flights15 \n", "203 40.652363 -75.440402 19.20 \n", "126 32.411320 -99.681897 20.57 \n", "64 35.040222 -106.609194 19.18 \n", "176 40.978115 -124.108619 24.88 \n", "167 31.327372 -92.548556 18.67 \n", "187 33.369955 -81.964496 19.84 \n", "198 42.748119 -73.802979 20.29 \n", "98 39.223160 -106.868845 23.07 \n", "1 33.640444 -84.426944 16.82 \n", "211 44.257408 -88.519476 19.59 \n", "\n", "[10 rows x 23 columns]" ] }, "execution_count": 139, "metadata": {}, "output_type": "execute_result" } ], "source": [ "merged_df['% of Flights15'] = (round(merged_df['arr_del15']/merged_df['arr_flights'], 4))*100\n", "merged_df.head(10)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Plot: " ] }, { "cell_type": "code", "execution_count": 140, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "lat": [ 40.65236278, 32.41132, 35.04022222, 40.97811528, 31.32737167, 33.369955, 42.74811944, 39.22316, 33.64044444, 44.25740806, 30.19453278, 35.43619444, 41.33814944, 41.93887417, 33.56294306, 45.8076625, 46.77411111, 36.385913, 48.79275, 40.47798556, 36.12447667, 43.56444444, 42.3643475, 31.25902778, 30.53316083, 44.47300361, 42.94052472, 34.20061917, 39.17540167, 45.77690139, 33.93884, 40.91631194, 37.70097028, 35.03526833, 38.13863889, 32.89864639, 41.88458833, 41.41089417, 35.21401111, 39.99798528, 40.03925, 44.52019417, 38.80580556, 42.90835556, 27.77036083, 38.37315083, 32.51633333, 39.04614278, 44.77761917, 41.155722499999996, 29.17991667, 32.84711389, 39.90237583, 42.40295944, 38.85208333, 39.85840806, 32.89595056, 31.32133917, 46.84209028, 41.53493306, 42.21205889, 44.86525722, 30.448674, 39.64256778, 31.80666667, 44.123259999999995, 38.03799139, 35.07297222, 40.69249722, 46.91934889, 36.77619444, 34.99147222, 48.31140472, 26.07258333, 42.96550333, 43.58135111, 35.33659028, 40.97846583, 44.34889806, 47.61985556, 47.949255, 39.1224125, 30.40728028, 44.48507333, 31.06489778, 42.88081972, 36.09774694, 34.89566722, 47.48200194, 33.45033444, 38.53396333, 40.48118028, 46.60681806, 29.64541861, 41.06695778, 26.22850611, 34.6404475, 38.94453194, 29.98047222, 37.64995889, 43.51455556, 34.27061111, 39.71732917, 40.7952425, 35.65884306, 43.60732417, 32.31116667, 30.49405556, 40.63975111, 36.08036111, 33.94253611, 33.66363889, 38.03697222, 30.20527972, 40.77724306, 33.81772222, 34.72939611, 42.15614361, 40.85097222, 27.54373861, 37.85830556, 46.37449806, 31.94252778, 39.29760528, 28.42888889, 40.19349528, 41.7859825, 32.33313333, 35.04241667, 26.17583333, 42.37422778, 32.30064417, 39.14096722, 42.93451639, 25.79325, 42.94722222, 28.10275, 41.44852639, 32.51086556, 37.62404861, 30.69141667, 48.25937778, 46.353639, 36.5869825, 43.13985778, 44.88054694, 29.99338889, 38.50886722, 33.67975, 34.82916444, 37.72129083, 35.39308833, 41.30251861, 34.056, 41.979595, 36.89461111, 43.41713889, 37.06083333, 26.68316194, 45.58872222, 37.13189556, 39.87195278, 33.43416667, 40.66424333, 27.91076333, 42.91130556, 40.49146583, 30.47330556, 46.26468028, 33.82921556, 41.72399917, 43.64616667, 44.04532139, 40.50898361, 44.25406722, 35.87763889, 37.50516667, 41.5942175, 39.49857611, 37.32546833, 43.11886611, 43.90882639, 26.53616667, 35.61677778, 32.73355611, 29.53369444, 32.12758333, 34.42621194, 41.70895361, 35.23705806, 38.17438889, 47.44898194, 37.61900194, 37.24432611, 32.446627500000005, 37.36186194, 40.78838778, 38.69542167, 34.89924833, 33.67565861, 39.84395194, 33.98879611, 27.39533333, 38.74768694, 41.50409361, 43.11118694, 37.95375861, 30.39652778, 27.97547222, 36.47521417, 36.19837222, 32.11608333, 44.74144472, 42.48180389, 32.35413889, 35.81248722, 34.681499, 30.7825, 30.48325, 36.28186944, 32.65658333 ], "locationmode": "USA-states", "lon": [ -75.44040167, -99.68189722, -106.6091944, -124.1086189, -92.54855611, -81.96449611, -73.80297861, -106.868845, -84.42694444, -88.51947556, -97.66987194, -82.54180556, -75.72426750000001, -72.68322833, -86.75354972, -108.54286110000001, -100.74672220000001, -92.548828, -122.53752779999999, -88.91595278, -86.67818222, -116.22277779999999, -71.00517917, -81.46630556, -91.14963444, -73.1503125, -78.73216667, -118.3584969, -76.66819833, -111.15300719999999, -81.11953944, -81.44246556, -113.098575, -85.20378778, -78.45286111, -80.04050583, -91.71087222, -81.84939667, -80.94312583, -82.89188278, -88.27805556, -109.02379609999998, -104.70025, -106.46446609999998, -97.50121528, -81.59318972, -84.93886111, -84.6621725, -89.66677944, -104.81183809999999, -81.05805556, -96.85177222, -84.219375, -90.70916722, -77.03772222, -104.6670019, -97.0372, -85.44962889, -92.19364861, -93.66068222, -83.34883583, -91.48507194, -84.550781, -106.91769529999999, -106.37780559999999, -123.21868559999999, -87.53062667, -77.04294444, -74.16866056, -96.81498889, -119.7181389, -78.88, -114.25506940000001, -80.15275, -83.74345639, -96.74170028, -94.36744111, -85.19514639, -105.5393614, -117.5338425, -97.17611111, -108.5267347, -89.07009278, -88.12959000000001, -97.82779778, -85.52276778, -79.9372975, -82.21885833, -111.37068529999999, -88.59136861, -106.9331817, -107.21765970000001, -111.9827503, -95.27888889, -73.70757444, -97.65439389, -86.77310944, -77.45580972, -95.33972222, -97.43304583, -112.07016670000002, -77.90255556, -86.29438417, -73.10021194, -117.8295122, -110.7377389, -90.07588889, -81.68786111, -73.77892556, -115.15233329999998, -118.40807439999999, -101.8227778, -84.60538889, -91.987655, -73.87260917, -118.1516111, -92.22424556, -121.7332081, -96.75925, -99.46154361, -80.39947222, -117.01539440000002, -102.20191390000001, -94.71390556, -81.31602778, -76.76340361, -87.75242444, -88.75120556, -89.97666667, -98.23861111, -122.8734978, -86.39397611, -96.67083278, -71.43705583, -80.29055556, -87.89658333, -80.64580556, -90.50753917, -92.03768778, -118.8377722, -88.24283333, -101.2803339, -87.395361, -121.84294779999999, -89.33751361, -93.2169225, -90.25802778, -107.89383329999998, -78.92833333, -77.61213778, -122.22071670000001, -97.60073389, -95.89417306, -117.60119440000001, -87.90446417, -76.20122222, -124.2460278, -88.77375, -80.09559417, -122.5975, -76.4929875, -75.24114083, -112.00805559999999, -89.69330556, -82.68743944, -112.59586110000001, -80.23287083, -87.18744444, -119.11902920000001, -116.5062531, -71.42822111, -70.30875, -103.0573708, -122.2934019, -121.1499633, -78.78747222, -77.31966667, -109.0651928, -119.76806470000001, -79.97542833, -77.67238389, -92.49798722, -81.75516667, -106.08813889999999, -117.1896567, -98.46977778, -81.20213889, -119.8403733, -86.31847417, -120.64239309999999, -85.736, -122.30931310000001, -122.3748433, -93.38685806, -93.82559833, -121.92900890000001, -111.9777731, -121.5907669, -120.4575825, -117.86822250000002, -89.67761861, -98.49189333, -82.55411111, -90.35998972, -74.10483833, -76.10631056, -107.90848000000001, -84.35033333, -82.53325, -82.40742056, -95.88824167, -110.94102779999999, -85.582235, -114.4877356, -95.40238611, -83.99285583, -90.348816, -83.27672222, -86.5254, -94.30681111, -114.60597220000001 ], "marker": { "autocolorscale": false, "cmax": 29.79, "cmin": 0, "color": [ 19.2, 20.57, 19.18, 24.88, 18.67, 19.84, 20.29, 23.07, 16.82, 19.59, 19.46, 19.68, 21.4, 19.97, 20.16, 14.069999999999999, 17.52, 14.799999999999999, 12.55, 20.32, 18.7, 17.94, 21.17, 18.42, 20.14, 21.8, 20.02, 16.42, 17.23, 15.21, 21.5, 20.28, 13.3, 19.869999999999997, 21.490000000000002, 19.189999999999998, 19.86, 18.57, 15.93, 19.67, 23.849999999999998, 14.540000000000001, 22.2, 13.28, 20.26, 20.849999999999998, 19.24, 17.22, 20.46, 15.5, 17.54, 17.96, 19.830000000000002, 19.040000000000003, 18.16, 17.41, 17.66, 19.35, 16.470000000000002, 20.94, 15.790000000000001, 19.85, 18.48, 21.57, 20.59, 18.22, 18.42, 20.119999999999997, 26.650000000000002, 19.439999999999998, 18.27, 19.34, 14.580000000000002, 20.97, 18.38, 21.77, 18.970000000000002, 20.61, 15.129999999999999, 16.86, 13.65, 14.510000000000002, 18.55, 19.34, 19.64, 19.85, 21.26, 20.41, 13.100000000000001, 17.98, 21.26, 18.86, 12.18, 19.009999999999998, 22.27, 19.580000000000002, 18.64, 17.810000000000002, 17.34, 20.5, 13.16, 17.95, 18.95, 20.919999999999998, 8.9, 19.12, 19.32, 19.55, 21.78, 17.740000000000002, 19.830000000000002, 20.64, 19.580000000000002, 18.39, 23.68, 15.85, 21.14, 17.51, 20.76, 18.82, 20.77, 6.4799999999999995, 20.64, 18.94, 19.12, 19.13, 17.26, 21.18, 16.53, 20.32, 20.75, 19.43, 22.21, 20.380000000000003, 18.83, 18.4, 17.01, 21.41, 18.96, 17.68, 19.54, 17.18, 22.470000000000002, 18.52, 19.55, 15.75, 18.62, 19.939999999999998, 17.31, 20.47, 18.04, 21.5, 19.950000000000003, 18.45, 20.200000000000003, 20.06, 29.79, 20.119999999999997, 21.84, 16.470000000000002, 19.66, 20.19, 15.6, 20.3, 22.13, 9.56, 18.65, 18.6, 16.11, 17.72, 19.53, 20.669999999999998, 17.14, 25.430000000000003, 16.74, 19.25, 20.97, 13.88, 18.310000000000002, 20.13, 20.43, 18.37, 18.32, 19.509999999999998, 18.08, 19.830000000000002, 19.84, 17.49, 20.03, 18.59, 20.41, 16.61, 25.83, 20.919999999999998, 19.439999999999998, 16.939999999999998, 13.350000000000001, 18.18, 12.75, 15.229999999999999, 19.73, 17.96, 16.71, 18.3, 23.59, 21.37, 6.84, 18.72, 18.72, 17.5, 21.560000000000002, 19.45, 19.919999999999998, 10.81, 18.43, 22, 8.649999999999999, 18.68, 20.28, 21.52, 11.27 ], "colorbar": { "title": { "text": "% flights
Delayed by >15 mins" } }, "colorscale": "Rainbow", "line": { "color": "rgba(205, 102, 102)", "width": 1 }, "opacity": 0.8, "reversescale": true, "size": [ 19.2, 20.57, 19.18, 24.88, 18.67, 19.84, 20.29, 23.07, 16.82, 19.59, 19.46, 19.68, 21.4, 19.97, 20.16, 14.069999999999999, 17.52, 14.799999999999999, 12.55, 20.32, 18.7, 17.94, 21.17, 18.42, 20.14, 21.8, 20.02, 16.42, 17.23, 15.21, 21.5, 20.28, 13.3, 19.869999999999997, 21.490000000000002, 19.189999999999998, 19.86, 18.57, 15.93, 19.67, 23.849999999999998, 14.540000000000001, 22.2, 13.28, 20.26, 20.849999999999998, 19.24, 17.22, 20.46, 15.5, 17.54, 17.96, 19.830000000000002, 19.040000000000003, 18.16, 17.41, 17.66, 19.35, 16.470000000000002, 20.94, 15.790000000000001, 19.85, 18.48, 21.57, 20.59, 18.22, 18.42, 20.119999999999997, 26.650000000000002, 19.439999999999998, 18.27, 19.34, 14.580000000000002, 20.97, 18.38, 21.77, 18.970000000000002, 20.61, 15.129999999999999, 16.86, 13.65, 14.510000000000002, 18.55, 19.34, 19.64, 19.85, 21.26, 20.41, 13.100000000000001, 17.98, 21.26, 18.86, 12.18, 19.009999999999998, 22.27, 19.580000000000002, 18.64, 17.810000000000002, 17.34, 20.5, 13.16, 17.95, 18.95, 20.919999999999998, 8.9, 19.12, 19.32, 19.55, 21.78, 17.740000000000002, 19.830000000000002, 20.64, 19.580000000000002, 18.39, 23.68, 15.85, 21.14, 17.51, 20.76, 18.82, 20.77, 6.4799999999999995, 20.64, 18.94, 19.12, 19.13, 17.26, 21.18, 16.53, 20.32, 20.75, 19.43, 22.21, 20.380000000000003, 18.83, 18.4, 17.01, 21.41, 18.96, 17.68, 19.54, 17.18, 22.470000000000002, 18.52, 19.55, 15.75, 18.62, 19.939999999999998, 17.31, 20.47, 18.04, 21.5, 19.950000000000003, 18.45, 20.200000000000003, 20.06, 29.79, 20.119999999999997, 21.84, 16.470000000000002, 19.66, 20.19, 15.6, 20.3, 22.13, 9.56, 18.65, 18.6, 16.11, 17.72, 19.53, 20.669999999999998, 17.14, 25.430000000000003, 16.74, 19.25, 20.97, 13.88, 18.310000000000002, 20.13, 20.43, 18.37, 18.32, 19.509999999999998, 18.08, 19.830000000000002, 19.84, 17.49, 20.03, 18.59, 20.41, 16.61, 25.83, 20.919999999999998, 19.439999999999998, 16.939999999999998, 13.350000000000001, 18.18, 12.75, 15.229999999999999, 19.73, 17.96, 16.71, 18.3, 23.59, 21.37, 6.84, 18.72, 18.72, 17.5, 21.560000000000002, 19.45, 19.919999999999998, 10.81, 18.43, 22, 8.649999999999999, 18.68, 20.28, 21.52, 11.27 ], "symbol": "circle" }, "mode": "markers", "text": [ "Lehigh Valley International, Allentown, PA, 19.2%", "Abilene Regional, Abilene, TX, 20.57%", "Albuquerque International, Albuquerque, NM, 19.18%", "Arcata, Arcata/Eureka, CA, 24.88%", "Alexandria International, Alexandria, LA, 18.67%", "Bush , Augusta, GA, 19.84%", "Albany Cty, Albany, NY, 20.29%", "Aspen-Pitkin Co/Sardy , Aspen, CO, 23.07%", "William B Hartsfield-Atlanta Intl, Atlanta, GA, 16.82%", "Outagamie County Regional, Appleton, WI, 19.59%", "Austin-Bergstrom International, Austin, TX, 19.46%", "Asheville Regional, Asheville, NC, 19.68%", "Wilkes-Barre/Scranton Intl, Wilkes-Barre/Scranton, PA, 21.4%", "Bradley International, Windsor Locks, CT, 19.97%", "Birmingham International, Birmingham, AL, 20.16%", "Billings Logan Intl, Billings, MT, 14.069999999999999%", "Bismarck Municipal, Bismarck, ND, 17.52%", "Branson Airport, Hollister, MO, 14.799999999999999%", "Bellingham Intl, Bellingham, WA, 12.55%", "Central Illinois Regional, Bloomington, IL, 20.32%", "Nashville International, Nashville, TN, 18.7%", "Boise Air Terminal, Boise, ID, 17.94%", "Gen Edw L Logan Intl, Boston, MA, 21.17%", "Glynco Jetport, Brunswick, GA, 18.42%", "Baton Rouge Metropolitan, Ryan , Baton Rouge, LA, 20.14%", "Burlington International, Burlington, VT, 21.8%", "Buffalo Niagara Intl, Buffalo, NY, 20.02%", "Burbank-Glendale-Pasadena, Burbank, CA, 16.42%", "Baltimore-Washington International, Baltimore, MD, 17.23%", "Gallatin , Bozeman, MT, 15.21%", "Columbia Metropolitan, Columbia, SC, 21.5%", "Akron-Canton Regional, Akron, OH, 20.28%", "Cedar City Muni, Cedar City, UT, 13.3%", "Lovell , Chattanooga, TN, 19.869999999999997%", "Charlottesville-Albermarle, Charlottesville, VA, 21.490000000000002%", "Charleston AFB/International, Charleston, SC, 19.189999999999998%", "Eastern Iowa , Cedar Rapids, IA, 19.86%", "Cleveland-Hopkins Intl, Cleveland, OH, 18.57%", "Charlotte/Douglas International, Charlotte, NC, 15.93%", "Port Columbus Intl, Columbus, OH, 19.67%", "University of Illinois-Willard, Champaign/Urbana, IL, 23.849999999999998%", "Yellowstone Regional, Cody, WY, 14.540000000000001%", "City of Colorado Springs Muni, Colorado Springs, CO, 22.2%", "Natrona County Intl, Casper, WY, 13.28%", "Corpus Christi International, Corpus Christi, TX, 20.26%", "Yeager, Charleston, WV, 20.849999999999998%", "Columbus Metropolitan, Columbus, GA, 19.24%", "Cincinnati Northern Kentucky Intl, Covington, KY, 17.22%", "Central Wisconsin, Mosinee, WI, 20.46%", "Cheyenne, Cheyenne, WY, 15.5%", "Daytona Beach International, Daytona Beach, FL, 17.54%", "Dallas Love , Dallas, TX, 17.96%", "James M Cox Dayton Intl, Dayton, OH, 19.830000000000002%", "Dubuque Municipal, Dubuque, IA, 19.040000000000003%", "Ronald Reagan Washington National, Arlington, VA, 18.16%", "Denver Intl, Denver, CO, 17.41%", "Dallas-Fort Worth International, Dallas-Fort Worth, TX, 17.66%", "Dothan , Dothan, AL, 19.35%", "Duluth International, Duluth, MN, 16.470000000000002%", "Des Moines International, Des Moines, IA, 20.94%", "Detroit Metropolitan-Wayne County, Detroit, MI, 15.790000000000001%", "Chippewa Valley Regional, Eau Claire, WI, 19.85%", "Florida Beach, Beaches, FL, 18.48%", "Eagle County Regional, Eagle, CO, 21.57%", "El Paso International, El Paso, TX, 20.59%", "Mahlon Sweet , Eugene, OR, 18.22%", "Evansville Regional, Evansville, IN, 18.42%", "Craven County Regional, New Bern, NC, 20.119999999999997%", "Newark Intl, Newark, NJ, 26.650000000000002%", "Hector International, Fargo, ND, 19.439999999999998%", "Fresno Yosemite International, Fresno, CA, 18.27%", "Fayetteville Municipal, Fayetteville, NC, 19.34%", "Glacier Park Intl, Kalispell, MT, 14.580000000000002%", "Fort Lauderdale-Hollywood Int'l, Ft. Lauderdale, FL, 20.97%", "Bishop, Flint, MI, 18.38%", "Joe Foss , Sioux Falls, SD, 21.77%", "Fort Smith Regional, Fort Smith, AR, 18.970000000000002%", "Fort Wayne International, Fort Wayne, IN, 20.61%", "Gillette-Campbell County, Gillette, WY, 15.129999999999999%", "Spokane Intl, Spokane, WA, 16.86%", "Grand Forks International, Grand Forks, ND, 13.65%", "Walker , Grand Junction, CO, 14.510000000000002%", "Gulfport-Biloxi Regional, Gulfport-Biloxi, MS, 18.55%", "Austin Straubel International, Green Bay, WI, 19.34%", "Robert Gray AAF, Killeen, TX, 19.64%", "Kent County International, Grand Rapids, MI, 19.85%", "Piedmont Triad International, Greensboro, NC, 21.26%", "Greenville-Spartanburg, Greer, SC, 20.41%", "Great Falls Intl, Great Falls, MT, 13.100000000000001%", "Golden Triangle Regional, Columbus-Starkville-West Point, MS, 17.98%", "Gunnison County, Gunnison, CO, 21.26%", "Yampa Valley, Hayden, CO, 18.86%", "Helena Regional, Helena, MT, 12.18%", "William P Hobby, Houston, TX, 19.009999999999998%", "Westchester Cty, White Plains, NY, 22.27%", "Valley International, Harlingen, TX, 19.580000000000002%", "Huntsville International , Huntsville, AL, 18.64%", "Washington Dulles International, Chantilly, VA, 17.810000000000002%", "George Bush Intercontinental, Houston, TX, 17.34%", "Wichita Mid-Continent, Wichita, KS, 20.5%", "Idaho Falls Regional, Idaho Falls, ID, 13.16%", "Wilmington International, Wilmington, NC, 17.95%", "Indianapolis International, Indianapolis, IN, 18.95%", "Long Island - MacArthur, Islip, NY, 20.919999999999998%", "Inyokern, Inyokern, CA, 8.9%", "Jackson Hole, Jackson, WY, 19.12%", "Jackson International, Jackson, MS, 19.32%", "Jacksonville International, Jacksonville, FL, 19.55%", "John F Kennedy Intl, New York, NY, 21.78%", "McCarran International, Las Vegas, NV, 17.740000000000002%", "Los Angeles International, Los Angeles, CA, 19.830000000000002%", "Lubbock International, Lubbock, TX, 20.64%", "Blue Grass , Lexington, KY, 19.580000000000002%", "Lafayette Regional, Lafayette, LA, 18.39%", "LaGuardia, New York, NY, 23.68%", "Long Beach (Daugherty ), Long Beach, CA, 15.85%", "Adams , Little Rock, AR, 21.14%", "Klamath Falls International, Klamath Falls, OR, 17.51%", "Lincoln Municipal, Lincoln, NE, 20.76%", "Laredo International, Laredo, TX, 18.82%", "Greenbrier Valley, Lewisburg, WV, 20.77%", "Lewiston-Nez Perce County, Lewiston, ID, 6.4799999999999995%", "Midland International, Midland, TX, 20.64%", "Kansas City International, Kansas City, MO, 18.94%", "Orlando International, Orlando, FL, 19.12%", "Harrisburg Intl, Harrisburg, PA, 19.13%", "Chicago Midway, Chicago, IL, 17.26%", "Key , Meridian, MS, 21.18%", "Memphis International, Memphis, TN, 16.53%", "McAllen Miller International, McAllen, TX, 20.32%", "Rogue Valley International, Medford, OR, 20.75%", "Montgomery Regional Apt, Montgomery, AL, 19.43%", "Manhattan Regional, Manhattan, KS, 22.21%", "Manchester, Manchester, NH, 20.380000000000003%", "Miami International, Miami, FL, 18.83%", "General Mitchell International, Milwaukee, WI, 18.4%", "Melbourne International , Melbourne, FL, 17.01%", "Quad City, Moline, IL, 21.41%", "Monroe Regional, Monroe, LA, 18.96%", "Mammoth Yosemite, Mammoth Lakes, CA, 17.68%", "Mobile Regional, Mobile, AL, 19.54%", "Minot International, Minot, ND, 17.18%", null, "Monterey Peninsula, Monterey, CA, 18.52%", "Dane County Regional, Madison, WI, 19.55%", "Minneapolis-St Paul Intl, Minneapolis, MN, 15.75%", "New Orleans International , New Orleans, LA, 18.62%", "Montrose Regional, Montrose, CO, 19.939999999999998%", "Myrtle Beach International, Myrtle Beach, SC, 17.31%", "Albert J Ellis, Jacksonville, NC, 20.47%", "Metropolitan Oakland International, Oakland, CA, 18.04%", "Will Rogers World, Oklahoma City, OK, 21.5%", "Eppley Airfield, Omaha, NE, 19.950000000000003%", "Ontario International, Ontario, CA, 18.45%", "Chicago O'Hare International, Chicago, IL, 20.200000000000003%", "Norfolk International, Norfolk, VA, 20.06%", "North Bend Muni, North Bend, OR, 29.79%", "Barkley Regional, Paducah, KY, 20.119999999999997%", "Palm Beach International, West Palm Beach, FL, 21.84%", "Portland Intl, Portland, OR, 16.470000000000002%", "Newport News/Williamsburg International, Newport News, VA, 19.66%", "Philadelphia Intl, Philadelphia, PA, 20.19%", "Phoenix Sky Harbor International, Phoenix, AZ, 15.6%", "Greater Peoria Regional, Peoria, IL, 20.3%", "St. Petersburg-Clearwater International, St. Petersburg, FL, 22.13%", "Pocatello Regional, Pocatello, ID, 9.56%", "Pittsburgh International, Pittsburgh, PA, 18.65%", "Pensacola Regional, Pensacola, FL, 18.6%", "Tri-Cities, Pasco, WA, 16.11%", "Palm Springs International, Palm Springs, CA, 17.72%", "Theodore F Green State, Providence, RI, 19.53%", "Portland International Jetport, Portland, ME, 20.669999999999998%", "Rapid City Regional, Rapid City, SD, 17.14%", "Redding Municipal, Redding, CA, 25.430000000000003%", "Roberts , Redmond, OR, 16.74%", "Raleigh-Durham International, Raleigh, NC, 19.25%", "Richmond International, Richmond, VA, 20.97%", "Rock Springs-Sweetwater County, Rock Springs, WY, 13.88%", "Reno/Tahoe International, Reno, NV, 18.310000000000002%", "Roanoke Regional/ Woodrum , Roanoke, VA, 20.13%", "Greater Rochester Int'l, Rochester, NY, 20.43%", "Rochester International, Rochester, MN, 18.37%", "Southwest Florida International, Ft. Myers, FL, 18.32%", "Santa Fe Municipal, Santa Fe, NM, 19.509999999999998%", "San Diego International-Lindbergh , San Diego, CA, 18.08%", "San Antonio International, San Antonio, TX, 19.830000000000002%", "Savannah International, Savannah, GA, 19.84%", "Santa Barbara Municipal, Santa Barbara, CA, 17.49%", "South Bend Regional, South Bend, IN, 20.03%", "San Luis Obispo Co-McChesney , San Luis Obispo, CA, 18.59%", "Louisville International-Standiford , Louisville, KY, 20.41%", "Seattle-Tacoma Intl, Seattle, WA, 16.61%", "San Francisco International, San Francisco, CA, 25.83%", "Springfield-Branson Regional, Springfield, MO, 20.919999999999998%", "Shreveport Regional, Shreveport, LA, 19.439999999999998%", "San Jose International, San Jose, CA, 16.939999999999998%", "Salt Lake City Intl, Salt Lake City, UT, 13.350000000000001%", "Sacramento International, Sacramento, CA, 18.18%", "Santa Maria Pub/Capt G Allan Hancock , Santa Maria, CA, 12.75%", "John Wayne /Orange Co, Santa Ana, CA, 15.229999999999999%", "Capital, Springfield, IL, 19.73%", "Sheppard AFB/Wichita Falls Municipal, Wichita Falls, TX, 17.96%", "Sarasota Bradenton International, Sarasota, FL, 16.71%", "Lambert-St Louis International, St Louis, MO, 18.3%", "Stewart, Newburgh, NY, 23.59%", "Syracuse-Hancock Intl, Syracuse, NY, 21.37%", "Telluride Regional, Telluride, CO, 6.84%", "Tallahassee Regional, Tallahassee, FL, 18.72%", "Tampa International , Tampa, FL, 18.72%", "Tri-Cities Regional, Bristol, TN, 17.5%", "Tulsa International, Tulsa, OK, 21.560000000000002%", "Tucson International, Tucson, AZ, 19.45%", "Cherry Capital, Traverse City, MI, 19.919999999999998%", "Joslin Field - Magic Valley, Twin Falls, ID, 10.81%", "Tyler Pounds , Tyler, TX, 18.43%", "McGhee-Tyson, Knoxville, TN, 22.0%", "Tunica Municipal Airport, Tunica, MS, 8.649999999999999%", "Valdosta Regional, Valdosta, GA, 18.68%", "Eglin Air Force Base, Valparaiso, FL, 20.28%", "Northwest Arkansas Regional, Fayetteville/Springdale/Rogers, AR, 21.52%", "Yuma MCAS-Yuma International, Yuma, AZ, 11.27%" ], "type": "scattergeo", "uid": "d724b011-7010-409a-951b-77f02de4ea8c" } ], "layout": { "geo": { "countrycolor": "rgb(217, 217, 217)", "countrywidth": 0.5, "landcolor": "rgb(250, 250, 250)", "projection": { "type": "albers usa" }, "scope": "usa", "showland": true, "subunitcolor": "rgb(217, 217, 217)", "subunitwidth": 0.5 }, "title": { "text": "% of flights delayed for more than 15 mins
(Hover for airport names)" } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "trace = go.Scattergeo(locationmode = 'USA-states',\n", " lon = merged_df['long'], \n", " lat = merged_df['lat'], \n", " text= merged_df['airport'] +\", \"+ merged_df['city']+ \", \"+ merged_df['state']+\", \" +merged_df['% of Flights15'].astype(str)+\"%\",\n", " mode='markers',\n", " marker = dict(size = merged_df['% of Flights15'],\n", " opacity = 0.8,\n", " reversescale=True,\n", " autocolorscale = False,\n", " symbol = 'circle',\n", " line = dict(width=1,\n", " color='rgba(205, 102, 102)'),\n", " colorscale = 'Rainbow',\n", " cmin = 0,\n", " color = merged_df['% of Flights15'],\n", " cmax = merged_df['% of Flights15'].max(),\n", " colorbar_title=\"% flights
Delayed by >15 mins\"\n", " ))\n", "fig = go.Figure(data = [trace])\n", "\n", "fig.layout.update(\n", " title = '% of flights delayed for more than 15 mins
(Hover for airport names)',\n", " geo = dict(\n", " scope='usa',\n", " projection_type='albers usa',\n", " showland = True,\n", " landcolor = \"rgb(250, 250, 250)\",\n", " subunitcolor = \"rgb(217, 217, 217)\",\n", " countrycolor = \"rgb(217, 217, 217)\",\n", " countrywidth = 0.5,\n", " subunitwidth = 0.5\n", " ),\n", " )\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ " On hovering we can find out the delays 221 airports across the USA. But let's find out, differently, which region of airport has most significant number of delays. " ] }, { "cell_type": "code", "execution_count": 141, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['year', ' month', 'arr_flights', 'arr_del15', 'carrier_ct',\n", " ' weather_ct', 'nas_ct', 'security_ct', 'late_aircraft_ct',\n", " 'arr_cancelled', 'arr_diverted', ' arr_delay', ' carrier_delay',\n", " 'weather_delay', 'nas_delay', 'security_delay', 'late_aircraft_delay'],\n", " dtype='object')" ] }, "execution_count": 141, "metadata": {}, "output_type": "execute_result" } ], "source": [ "choro_df.columns" ] }, { "cell_type": "code", "execution_count": 142, "metadata": {}, "outputs": [], "source": [ "choro_df2 = choro_df[['carrier_ct', ' weather_ct', 'nas_ct',\n", " 'security_ct', 'late_aircraft_ct']]" ] }, { "cell_type": "code", "execution_count": 143, "metadata": {}, "outputs": [], "source": [ "choro_df2 = choro_df2.rename(columns = {'carrier_ct': 'Carrier', ' weather_ct':'Weather', 'nas_ct':'National Air System',\n", " 'security_ct':'Security', 'late_aircraft_ct':'Late Aircraft'})" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now, 'choro_df' is the one that has been grouped by the 'Airport' names (JFK, LAX, etc.). Now, I want to create a new column in this dataframe. The values of this column will state what has been the major cause of delay at these airports. " ] }, { "cell_type": "code", "execution_count": 144, "metadata": {}, "outputs": [], "source": [ "tp2_list = []\n", "for num in range(choro_df2.shape[0]): \n", " for i in choro_df2.iloc[num,:].index: \n", " if choro_df2.iloc[num,:][i]==np.max(choro_df2.iloc[num,:]):\n", " xx = i\n", " tp2_list.append(xx)\n" ] }, { "cell_type": "code", "execution_count": 145, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "405" ] }, "execution_count": 145, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(tp2_list) #There are rows with all their entries = 0" ] }, { "cell_type": "code", "execution_count": 146, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(381, 5)" ] }, "execution_count": 146, "metadata": {}, "output_type": "execute_result" } ], "source": [ "choro_df2.shape" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Something's wrong, instead of 381 values, there are 405 values in the list. \n", "\n", "On further analysis, we can find that there are rows (airports) that have all their values as 0. Which is why there were extra values as the code kept looping around those 0's of those particular airports. Let's get rid of those airports as they don't add anything to this piece of analysis. " ] }, { "cell_type": "code", "execution_count": 147, "metadata": {}, "outputs": [], "source": [ "choro_df2['max'] = list(choro_df2.apply(np.max, axis=1))" ] }, { "cell_type": "code", "execution_count": 148, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(375, 6)" ] }, "execution_count": 148, "metadata": {}, "output_type": "execute_result" } ], "source": [ "choro_df2 = choro_df2[choro_df2['max'] != 0] \n", "choro_df2.shape" ] }, { "cell_type": "code", "execution_count": 149, "metadata": {}, "outputs": [], "source": [ "tp2_list = []\n", "for num in range(choro_df2.shape[0]): \n", " for i in choro_df2.iloc[num,:5].index: \n", " if choro_df2.iloc[num,:5][i]==np.max(choro_df2.iloc[num,:5]):\n", " xx = i\n", " tp2_list.append(xx)" ] }, { "cell_type": "code", "execution_count": 150, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "375" ] }, "execution_count": 150, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(tp2_list)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now these values are of the same lenght! We can add 'tp2_list' as a new column. \n", "\n", "##### Let's call this column: \"Cause\"" ] }, { "cell_type": "code", "execution_count": 151, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CarrierWeatherNational Air SystemSecurityLate AircraftmaxCause
airport
ABE2339.05205.871463.035.401962.632339.05Carrier
ABI1623.86475.66704.1410.461374.791623.86Carrier
ABQ18862.461112.538667.76141.1623055.1923055.19Late Aircraft
ABR189.7624.11151.000.00167.17189.76Carrier
ABY751.8062.73325.772.00733.72751.80Carrier
ACK361.8598.35200.321.25200.25361.85Carrier
ACT896.01140.25408.462.69844.62896.01Carrier
ACV1333.74199.48913.700.913837.153837.15Late Aircraft
ACY773.9471.701764.7211.56982.031764.72National Air System
ADK40.884.0263.161.0237.9563.16National Air System
ADQ210.23123.61179.061.00116.07210.23Carrier
AEX2367.37292.241333.808.982136.652367.37Carrier
AGS2677.74222.851136.223.762285.292677.74Carrier
AKN33.370.0016.520.0025.1133.37Carrier
ALB8423.85663.023907.4541.707671.028423.85Carrier
\n", "
" ], "text/plain": [ " Carrier Weather National Air System Security Late Aircraft \\\n", "airport \n", "ABE 2339.05 205.87 1463.03 5.40 1962.63 \n", "ABI 1623.86 475.66 704.14 10.46 1374.79 \n", "ABQ 18862.46 1112.53 8667.76 141.16 23055.19 \n", "ABR 189.76 24.11 151.00 0.00 167.17 \n", "ABY 751.80 62.73 325.77 2.00 733.72 \n", "ACK 361.85 98.35 200.32 1.25 200.25 \n", "ACT 896.01 140.25 408.46 2.69 844.62 \n", "ACV 1333.74 199.48 913.70 0.91 3837.15 \n", "ACY 773.94 71.70 1764.72 11.56 982.03 \n", "ADK 40.88 4.02 63.16 1.02 37.95 \n", "ADQ 210.23 123.61 179.06 1.00 116.07 \n", "AEX 2367.37 292.24 1333.80 8.98 2136.65 \n", "AGS 2677.74 222.85 1136.22 3.76 2285.29 \n", "AKN 33.37 0.00 16.52 0.00 25.11 \n", "ALB 8423.85 663.02 3907.45 41.70 7671.02 \n", "\n", " max Cause \n", "airport \n", "ABE 2339.05 Carrier \n", "ABI 1623.86 Carrier \n", "ABQ 23055.19 Late Aircraft \n", "ABR 189.76 Carrier \n", "ABY 751.80 Carrier \n", "ACK 361.85 Carrier \n", "ACT 896.01 Carrier \n", "ACV 3837.15 Late Aircraft \n", "ACY 1764.72 National Air System \n", "ADK 63.16 National Air System \n", "ADQ 210.23 Carrier \n", "AEX 2367.37 Carrier \n", "AGS 2677.74 Carrier \n", "AKN 33.37 Carrier \n", "ALB 8423.85 Carrier " ] }, "execution_count": 151, "metadata": {}, "output_type": "execute_result" } ], "source": [ "choro_df2['Cause'] = tp2_list\n", "choro_df2.head(15) #values of 'Cause' column represent what the major cause of delay for the airline has been over the past 10 years" ] }, { "cell_type": "code", "execution_count": 152, "metadata": {}, "outputs": [], "source": [ "neww = pd.DataFrame({'Col': list(choro_df2['Cause'])})" ] }, { "cell_type": "code", "execution_count": 153, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['Late Aircraft', 'Carrier', 'National Air System'], dtype='object')" ] }, "execution_count": 153, "metadata": {}, "output_type": "execute_result" } ], "source": [ "neww['Col'].value_counts().index" ] }, { "cell_type": "code", "execution_count": 154, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "textposition": "auto", "type": "bar", "uid": "219e54db-e324-4211-9c1c-7ab308f13f66", "x": [ "Late Aircraft", "Carrier", "National Air System" ], "y": [ 170, 165, 40 ] } ], "layout": { "title": { "text": "Major cause of delay at Airports (Past 10 years)" }, "xaxis": { "title": { "text": "Major Cause of Delay" } }, "yaxis": { "title": { "text": "No. of Airports" } } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "data= go.Bar(x = neww['Col'].value_counts().index, \n", " y = neww['Col'].value_counts(),\n", " \n", " textposition = 'auto')\n", "\n", "\n", "\n", "fig = go.Figure()\n", "fig.add_trace(data)\n", "fig.layout.update(title = 'Major cause of delay at Airports (Past 10 years)', \n", " xaxis =dict(title='Major Cause of Delay'), \n", " yaxis= dict(title='No. of Airports'))\n", "iplot(fig)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### I don't like the Bar chart for this, let's try the Pie Chart." ] }, { "cell_type": "code", "execution_count": 155, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "labels": [ "Late Aircraft", "Carrier", "National Air System" ], "textinfo": "label+percent", "type": "pie", "uid": "76215fb2-0784-4d86-bdcc-7f659a8c0d7d", "values": [ 170, 165, 40 ] } ], "layout": { "title": { "text": "Major Cause of Delay in Airports" } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "labels = list(neww['Col'].value_counts().index)\n", "values = neww['Col'].value_counts()\n", "\n", "fig = go.Figure(data=[go.Pie(labels=labels, values=values, \n", " textinfo = 'label+percent')])\n", "\n", "fig.layout.update(title = 'Major Cause of Delay in Airports')\n", "iplot(fig)" ] }, { "cell_type": "code", "execution_count": 156, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "labels": [ "Carrier", "Weather", "National Air System", "Security", "Late Aircraft" ], "textinfo": "label+percent", "type": "pie", "uid": "7434b55a-dedf-4d86-a34d-a5f7013bfb3d", "values": [ 3285765.249999999, 353408.9000000002, 3656160.1599999964, 21925.820000000014, 4236662.6800000025 ] } ], "layout": { "title": { "text": "Major Cause of Delay of Past 10 years" } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "values2 = list(np.sum(choro_df2)[:5])\n", "labels2 = np.sum(choro_df2)[:5].index\n", "\n", "fig = go.Figure(data=[go.Pie(labels=labels2, values=values2, \n", " textinfo = 'label+percent')])\n", "\n", "fig.layout.update(title = 'Major Cause of Delay of Past 10 years')\n", "iplot(fig)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### This is a good plot and as you may think, it basically invalidates the 'Cause' column. It was redundant and not necessary. Let's stick with this. \n", "\n", "\n", "## Dot Plot \n", "\n", "Let's visualize this data rather differently, using a dot plot and dividing the data according to the Airports" ] }, { "cell_type": "code", "execution_count": 157, "metadata": {}, "outputs": [], "source": [ "choro_df2['Sum of Total Flights Delayed'] = list(choro_df2.iloc[:,:5].apply(np.sum, axis=1))" ] }, { "cell_type": "code", "execution_count": 158, "metadata": {}, "outputs": [], "source": [ "df_dotplot = choro_df2" ] }, { "cell_type": "code", "execution_count": 159, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Index(['Carrier', 'Weather', 'National Air System', 'Security',\n", " 'Late Aircraft', 'max', 'Cause', 'Sum of Total Flights Delayed'],\n", " dtype='object')" ] }, "execution_count": 159, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_dotplot.columns" ] }, { "cell_type": "code", "execution_count": 160, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": "rgba(0, 0, 255, 0.95)", "line": { "color": "rgba(156, 165, 196, 1.0)", "width": 1 }, "opacity": 0.6, "size": 6.5, "symbol": "circle" }, "mode": "markers", "name": "Percent of flights delayed due to Carrier", "type": "scatter", "uid": "00cb4e68-79d3-4976-8114-9bd9a8491984", "x": [ 39.1409, 38.7657, 36.3865, 35.6665, 40.0742, 41.977, 39.0924, 21.2211, 21.4748, 27.8038, 33.3714, 38.5625, 42.3301, 44.4933, 40.6811, 25.6506, 37.1746, 29.3605, 31.2419, 22.4604, 34.5896, 22.8799, 38.3124, 36.0843, 38.3639, 35.8762, 24.4629, 33.689, 37.8944, 34.115, 38.783, 30.581, 36.967, 36.1392, 38.5178, 36.2853, 34.4315, 34.7979, 33.0259, 30.0174, 34.5245, 39.5257, 33.2584, 32.8826, 25.9619, 34.8677, 43.1659, 41.8726, 33.6289, 36.532, 16.1313, 35.1869, 39.9615, 37.1372, 38.7894, 31.6578, 27.258, 36.0535, 38.4397, 31.2153, 25.5712, 24.0746, 17.729, 24.5723, 37.0631, 33.9601, 38.0526, 20.5248, 35.8113, 32.6035, 30.3032, 26.572, 30.341, 38.5048, 26.936, 35.023, 28.4758, 30.6818, 37.3264, 31.9296, 34.2914, 31.8542, 37.2824, 36.3644, 37.1401, 41.8211, 33.1456, 32.6106, 46.5333, 41.4463, 25.9578, 34.1461, 27.0941, 28.7731, 24.9884, 23.463, 42.6692, 29.8853, 35.4651, 35.7759, 38.0642, 29.8779, 35.1727, 27.992, 32.231, 31.1756, 33.2903, 38.6996, 39.4636, 36.8443, 44.2828, 36.0891, 36.7721, 33.0834, 30.0409, 36.2416, 39.3035, 16.437, 40.6107, 35.8738, 33.6369, 30.69, 43.6462, 36.4086, 44.6146, 31.0817, 35.9479, 36.6149, 25.558, 34.0263, 42.2033, 32.9789, 32.824, 36.3719, 36.413, 38.5555, 40.4225, 37.9999, 43.7342, 38.3859, 35.8613, 35.7754, 41.0932, 37.0066, 37.0412, 37.9405, 21.3444, 34.9912, 42.3112, 43.607, 38.2952, 36.0975, 52.2291, 19.1407, 30.1827, 31.9823, 43.4322, 34.4804, 28.5566, 40.0124, 33.4764, 38.2487, 36.0766, 24.3136, 41.8194, 28.7199, 29.272, 28.8171, 23.6567, 35.9308, 35.2183, 40.4566, 20.0489, 39.782, 28.6199, 35.8494, 21.9095, 29.6287, 30.6742, 35.3734, 38.7509, 50.2164, 33.5638, 38.7145, 39.8402, 37.4048, 22.9836, 33.6907, 30.2454, 29.7459, 42.593, 34.6682, 37.2494, 37.0487, 27.8256, 38.107, 25.916, 35.6886, 21.5225, 34.7036, 19.8404, 34.7056, 30.3306, 37.8026, 37.8534, 19.8916, 29.8799, 43.0516, 37.9595, 27.8724, 31.9599, 36.0671, 30.8326, 38.4265, 38.9604, 33.4282, 34.9836, 39.3489, 35.4159, 31.3019, 38.1918, 26.2706, 34.7812, 32.9884, 38.5108, 27.6655, 41.3119, 33.0717, 37.5433, 30.4319, 30.7123, 33.7439, 41.5398, 38.4723, 38.7799, 36.3056, 39.1175, 19.4058, 33.1544, 23.6621, 25.7954, 35.8856, 35.0851, 28.2045, 35.2933, 40.8853, 42.3675, 13.0775, 35.0144, 44.2178, 29.0615, 31.7742, 45.7425, 44.7895, 37.2612, 35.9621, 25.6708, 34.3217, 19.3986, 39.0565, 47.4619, 21.7703, 34.8801, 28.5201, 25.3355, 27.025, 32.5722, 34.5911, 31.4552, 35.2028, 22.1376, 37.7022, 34.6264, 24.4463, 29.4538, 34.1586, 17.4093, 23.3288, 34.3953, 28, 36.9725, 37.6778, 37.6138, 93.6154, 27.4259, 32.6351, 41.2414, 19.8029, 30.4119, 30.921, 39.4852, 36.9467, 39.1283, 37.6651, 34.9893, 21.4888, 29.3953, 35.9337, 35.4578, 27.8825, 35.9441, 36.4404, 33.5417, 42.4599, 36.967, 40.039, 34.9395, 34.4826, 39.6648, 31.9533, 37.249, 36.9495, 28.7625, 34.209, 27.8231, 30.6034, 36.3984, 28.7564, 36.8404, 28.149, 25.3517, 17.5509, 36.317, 30.0646, 22.7417, 40.2331, 28.4796, 29.7014, 37.3283, 42.0604, 29.1531, 24.9569, 31.0992, 27.3239, 33.27, 33.5995, 62.4477, 39.8869, 36.7009, 27.5266, 33.1663, 26.3966, 41.8585, 46.8985, 38.8638, 24.5882, 42.114, 36.69, 38.1172, 58.375, 41.4161, 31.0751, 33.1468, 42.7647, 19.9083, 38.2523, 34.7803, 36.9229, 33.9164, 41.5209, 37.9763, 36.708, 29.7442, 26.4788, 21.2321, 29.9444, 45.3441, 41.1505, 39.4651, 17.5669, 44.6394, 34.8632, 16.1467, 69.5, 41.7166 ], "y": [ "ABE", "ABI", "ABQ", "ABR", "ABY", "ACK", "ACT", "ACV", "ACY", "ADK", "ADQ", "AEX", "AGS", "AKN", "ALB", "ALO", "AMA", "ANC", "APN", "ART", "ASE", "ATL", "ATW", "AUS", "AVL", "AVP", "AZA", "AZO", "BDL", "BET", "BFF", "BFL", "BGM", "BGR", "BHM", "BIL", "BIS", "BJI", "BKG", "BLI", "BLV", "BMI", "BNA", "BOI", "BOS", "BPT", "BQK", "BQN", "BRD", "BRO", "BRW", "BTM", "BTR", "BTV", "BUF", "BUR", "BWI", "BZN", "CAE", "CAK", "CDC", "CDV", "CEC", "CGI", "CHA", "CHO", "CHS", "CIC", "CID", "CIU", "CKB", "CLD", "CLE", "CLL", "CLT", "CMH", "CMI", "CMX", "CNY", "COD", "COS", "COU", "CPR", "CRP", "CRW", "CSG", "CVG", "CWA", "CYS", "DAB", "DAL", "DAY", "DBQ", "DCA", "DEN", "DFW", "DHN", "DIK", "DLG", "DLH", "DRO", "DRT", "DSM", "DTW", "DVL", "EAR", "EAU", "ECP", "EGE", "EKO", "ELM", "ELP", "ERI", "ESC", "EUG", "EVV", "EWN", "EWR", "EYW", "FAI", "FAR", "FAT", "FAY", "FCA", "FLG", "FLL", "FLO", "FNT", "FOE", "FSD", "FSM", "FWA", "GCC", "GCK", "GEG", "GFK", "GGG", "GJT", "GNV", "GPT", "GRB", "GRI", "GRK", "GRR", "GSO", "GSP", "GST", "GTF", "GTR", "GUC", "GUM", "HDN", "HGR", "HHH", "HIB", "HLN", "HNL", "HOB", "HOU", "HPN", "HRL", "HSV", "HTS", "HVN", "HYA", "HYS", "IAD", "IAG", "IAH", "ICT", "IDA", "IFP", "ILG", "ILM", "IMT", "IND", "INL", "IPL", "ISN", "ISP", "ITH", "ITO", "IYK", "JAC", "JAN", "JAX", "JFK", "JLN", "JMS", "JNU", "KOA", "KTN", "LAN", "LAR", "LAS", "LAW", "LAX", "LBB", "LBE", "LBF", "LBL", "LCH", "LCK", "LEX", "LFT", "LGA", "LGB", "LIH", "LIT", "LMT", "LNK", "LRD", "LSE", "LWB", "LWS", "LYH", "MAF", "MBS", "MCI", "MCO", "MDT", "MDW", "MEI", "MEM", "MFE", "MFR", "MGM", "MHK", "MHT", "MIA", "MKE", "MKG", "MLB", "MLI", "MLU", "MMH", "MOB", "MOD", "MOT", "MQT", "MRY", "MSN", "MSO", "MSP", "MSY", "MTJ", "MVY", "MWH", "MYR", "OAJ", "OAK", "OGD", "OGG", "OGS", "OKC", "OMA", "OME", "ONT", "ORD", "ORF", "ORH", "OTH", "OTZ", "OWB", "OXR", "PAH", "PBG", "PBI", "PDX", "PFN", "PGD", "PGV", "PHF", "PHL", "PHX", "PIA", "PIB", "PIE", "PIH", "PIR", "PIT", "PLN", "PNS", "PPG", "PRC", "PSC", "PSE", "PSG", "PSM", "PSP", "PUB", "PVD", "PVU", "PWM", "RAP", "RDD", "RDM", "RDU", "RFD", "RHI", "RIC", "RKS", "RNO", "ROA", "ROC", "ROW", "RST", "RSW", "SAF", "SAN", "SAT", "SAV", "SBA", "SBN", "SBP", "SCC", "SCE", "SCK", "SDF", "SEA", "SFB", "SFO", "SGF", "SGU", "SHD", "SHV", "SIT", "SJC", "SJT", "SJU", "SLC", "SLN", "SMF", "SMX", "SNA", "SPI", "SPN", "SPS", "SRQ", "STC", "STL", "STS", "STT", "STX", "SUN", "SUX", "SWF", "SWO", "SYR", "TEX", "TLH", "TOL", "TPA", "TRI", "TTN", "TUL", "TUS", "TVC", "TWF", "TXK", "TYR", "TYS", "UIN", "USA", "UST", "UTM", "VEL", "VLD", "VPS", "WRG", "WYS", "XNA", "YAK", "YNG", "YUM" ] }, { "marker": { "color": "rgba(0, 255, 0, 0.95)", "line": { "color": "rgba(217, 217, 217, 1.0)", "width": 1 }, "opacity": 0.6, "size": 6.5, "symbol": "circle" }, "mode": "markers", "name": "Percent of flights delayed due to Weather", "type": "scatter", "uid": "c9ce430c-be92-423a-a36f-eec5d081f94b", "x": [ 3.445, 11.3552, 2.1461, 4.5316, 3.3438, 11.4092, 6.119, 3.1739, 1.9895, 2.7341, 19.6216, 4.7604, 3.5228, 0, 3.2019, 8.9154, 3.8723, 2.9227, 6.1008, 18.1248, 6.1741, 2.7785, 3.1129, 2.8972, 3.2871, 3.4187, 4.818, 6.8869, 3.5595, 10.7486, 2.1499, 1.5247, 5.8417, 4.5487, 3.8014, 3.9288, 3.7251, 4.9512, 2.8211, 2.4366, 7.1431, 4.3395, 3.2107, 1.8783, 2.9681, 3.4993, 1.9404, 2.7858, 7.8863, 2.9786, 11.1645, 9.6153, 3.4099, 3.5452, 3.478, 1.2173, 3.6025, 3.5808, 3.5937, 2.5266, 2.0587, 4.1858, 2.7179, 1.8735, 3.6608, 4.8304, 3.8165, 0.4535, 5.4128, 6.8426, 4.7864, 1.7279, 3.0653, 6.125, 2.8938, 3.7008, 10.7521, 4.7447, 9.3125, 4.9714, 3.1004, 8.0899, 4.7382, 4.1584, 3.3508, 2.881, 5.208, 5.1072, 7.6963, 5.374, 2.8593, 4.0713, 9.8947, 3.6664, 2.8777, 3.9155, 1.6172, 2.8729, 6.0306, 5.1042, 4.2194, 0.9809, 4.6804, 3.3591, 2.1512, 2.356, 2.1231, 4.3038, 7.2446, 4.2603, 2.4433, 2.5766, 4.445, 7.0491, 1.5883, 5.5339, 2.3173, 2.8, 5.2196, 3.3575, 4.5962, 1.9919, 2.9902, 3.1445, 4.4602, 2.5508, 1.2714, 3.1499, 1.0367, 4.2873, 5.2799, 4.9339, 3.7635, 10.4082, 1.9282, 4.0228, 6.8168, 4.6938, 2.5252, 4.4682, 4.4388, 8.8466, 5.7884, 4.1751, 4.074, 3.7811, 5.46, 3.0831, 1.7784, 6.8588, 0.6065, 4.9154, 9.3488, 7.359, 10.0891, 3.8837, 2.3246, 2.5125, 2.7772, 2.7169, 2.6609, 4.6476, 11.09, 7.7281, 2.3611, 3.8335, 3.3293, 5.8771, 3.121, 3.5313, 2.5274, 1.3879, 0.5905, 3.4152, 5.9316, 2.8754, 4.8064, 0.2563, 3.3778, 3.0949, 6.1782, 1.9835, 1.0468, 5.5896, 4.6085, 3.6071, 2.528, 7.8073, 7.8189, 5.5587, 1.4143, 3.9561, 3.0827, 3.5564, 2.5285, 6.7114, 2.6785, 3.9098, 3.2653, 4.0804, 2.4208, 6.7051, 9.9504, 4.4416, 4.8796, 3.7428, 1.4007, 1.6098, 4.0248, 1.404, 2.6962, 5.4491, 5.8437, 4.8251, 3.5374, 5.49, 3.498, 3.7136, 2.8579, 2.5602, 4.7303, 3.8076, 1.4004, 3.7973, 4.5311, 2.072, 3.7985, 9.226, 2.7445, 3.6467, 2.363, 3.4728, 4.4596, 4.0707, 3.2404, 4.9599, 4.1026, 0.6601, 3.5748, 8.1186, 2.303, 4.3067, 2.8775, 3.6776, 3.1103, 4.9098, 4.0574, 4.3502, 3.2427, 2.6617, 0.86, 10.4839, 1.7619, 14.0526, 3.4335, 3.1701, 10.7925, 1.3342, 2.7443, 3.7964, 4.5518, 1.7514, 7.958, 0, 0.4701, 1.8604, 2.6849, 2.725, 2.0928, 3.0427, 3.7844, 7.4586, 1.9162, 3.7282, 2.131, 4.4787, 0.5912, 5.6036, 2.798, 0, 3.3321, 8.8183, 4.989, 3.1077, 0.8519, 2.6445, 2.0678, 7.74, 7.6623, 2.1216, 3.8685, 3.1172, 6.3677, 3.2238, 4.4088, 0.6264, 1.608, 3.5264, 5.6115, 12.9009, 3.3238, 3.9407, 1.7024, 3.1167, 4.0553, 7.9569, 6.0003, 3.0154, 4.8718, 2.4512, 3.1891, 4.3441, 1.4624, 3.0621, 2.0125, 13.5948, 3.4264, 3.0721, 3.0734, 2.6305, 3.8218, 2.6181, 6.4663, 2.048, 5.3634, 3.2003, 3.4016, 1.5706, 6.912, 3.4692, 2.7474, 2.8524, 1.6635, 1.01, 2.4251, 3.9348, 6.2739, 7.3311, 3.3264, 2.4238, 2.8248, 1.8206, 4.1378, 4.878, 3.1053, 9.703, 3.1855, 8.4639, 4.2647, 8.8438, 4.788, 8.1048, 3.0258, 3.3056, 1.1023, 3.4706, 2.4169, 4.9649, 3.452, 6.8867, 6.819, 3.7961, 3.213, 9.3063, 0.9793, 5.5556, 1.088, 2.6635, 4.5688, 10.8489, 1.5046, 5.3679, 3.8578, 0, 1.5233 ], "y": [ "ABE", "ABI", "ABQ", "ABR", "ABY", "ACK", "ACT", "ACV", "ACY", "ADK", "ADQ", "AEX", "AGS", "AKN", "ALB", "ALO", "AMA", "ANC", "APN", "ART", "ASE", "ATL", "ATW", "AUS", "AVL", "AVP", "AZA", "AZO", "BDL", "BET", "BFF", "BFL", "BGM", "BGR", "BHM", "BIL", "BIS", "BJI", "BKG", "BLI", "BLV", "BMI", "BNA", "BOI", "BOS", "BPT", "BQK", "BQN", "BRD", "BRO", "BRW", "BTM", "BTR", "BTV", "BUF", "BUR", "BWI", "BZN", "CAE", "CAK", "CDC", "CDV", "CEC", "CGI", "CHA", "CHO", "CHS", "CIC", "CID", "CIU", "CKB", "CLD", "CLE", "CLL", "CLT", "CMH", "CMI", "CMX", "CNY", "COD", "COS", "COU", "CPR", "CRP", "CRW", "CSG", "CVG", "CWA", "CYS", "DAB", "DAL", "DAY", "DBQ", "DCA", "DEN", "DFW", "DHN", "DIK", "DLG", "DLH", "DRO", "DRT", "DSM", "DTW", "DVL", "EAR", "EAU", "ECP", "EGE", "EKO", "ELM", "ELP", "ERI", "ESC", "EUG", "EVV", "EWN", "EWR", "EYW", "FAI", "FAR", "FAT", "FAY", "FCA", "FLG", "FLL", "FLO", "FNT", "FOE", "FSD", "FSM", "FWA", "GCC", "GCK", "GEG", "GFK", "GGG", "GJT", "GNV", "GPT", "GRB", "GRI", "GRK", "GRR", "GSO", "GSP", "GST", "GTF", "GTR", "GUC", "GUM", "HDN", "HGR", "HHH", "HIB", "HLN", "HNL", "HOB", "HOU", "HPN", "HRL", "HSV", "HTS", "HVN", "HYA", "HYS", "IAD", "IAG", "IAH", "ICT", "IDA", "IFP", "ILG", "ILM", "IMT", "IND", "INL", "IPL", "ISN", "ISP", "ITH", "ITO", "IYK", "JAC", "JAN", "JAX", "JFK", "JLN", "JMS", "JNU", "KOA", "KTN", "LAN", "LAR", "LAS", "LAW", "LAX", "LBB", "LBE", "LBF", "LBL", "LCH", "LCK", "LEX", "LFT", "LGA", "LGB", "LIH", "LIT", "LMT", "LNK", "LRD", "LSE", "LWB", "LWS", "LYH", "MAF", "MBS", "MCI", "MCO", "MDT", "MDW", "MEI", "MEM", "MFE", "MFR", "MGM", "MHK", "MHT", "MIA", "MKE", "MKG", "MLB", "MLI", "MLU", "MMH", "MOB", "MOD", "MOT", "MQT", "MRY", "MSN", "MSO", "MSP", "MSY", "MTJ", "MVY", "MWH", "MYR", "OAJ", "OAK", "OGD", "OGG", "OGS", "OKC", "OMA", "OME", "ONT", "ORD", "ORF", "ORH", "OTH", "OTZ", "OWB", "OXR", "PAH", "PBG", "PBI", "PDX", "PFN", "PGD", "PGV", "PHF", "PHL", "PHX", "PIA", "PIB", "PIE", "PIH", "PIR", "PIT", "PLN", "PNS", "PPG", "PRC", "PSC", "PSE", "PSG", "PSM", "PSP", "PUB", "PVD", "PVU", "PWM", "RAP", "RDD", "RDM", "RDU", "RFD", "RHI", "RIC", "RKS", "RNO", "ROA", "ROC", "ROW", "RST", "RSW", "SAF", "SAN", "SAT", "SAV", "SBA", "SBN", "SBP", "SCC", "SCE", "SCK", "SDF", "SEA", "SFB", "SFO", "SGF", "SGU", "SHD", "SHV", "SIT", "SJC", "SJT", "SJU", "SLC", "SLN", "SMF", "SMX", "SNA", "SPI", "SPN", "SPS", "SRQ", "STC", "STL", "STS", "STT", "STX", "SUN", "SUX", "SWF", "SWO", "SYR", "TEX", "TLH", "TOL", "TPA", "TRI", "TTN", "TUL", "TUS", "TVC", "TWF", "TXK", "TYR", "TYS", "UIN", "USA", "UST", "UTM", "VEL", "VLD", "VPS", "WRG", "WYS", "XNA", "YAK", "YNG", "YUM" ] }, { "marker": { "color": "rgba(56, 65, 96, 0.95)", "line": { "color": "rgba(56, 65, 96, 1.0)", "width": 1 }, "opacity": 0.6, "size": 6.5, "symbol": "circle" }, "mode": "markers", "name": "Percent of flights delayed due to National Air System", "type": "scatter", "uid": "eae9da9a-554a-4efe-abe5-53d8dee8e2af", "x": [ 24.4818, 16.8096, 16.7205, 28.3813, 17.365, 23.2384, 17.8209, 14.5378, 48.9663, 42.9572, 28.4236, 21.7265, 17.9615, 22.0267, 18.8702, 31.2078, 18.2024, 34.1343, 21.1626, 30.5528, 25.4465, 37.5837, 24.9036, 22.2588, 22.1326, 23.932, 23.4629, 28.3122, 21.5726, 28.0091, 14.4233, 17.9055, 30.0768, 27.8131, 19.5316, 26.3748, 26.8242, 31.735, 25.4364, 35.2796, 28.3056, 21.9567, 21.261, 17.0928, 37.8666, 22.6224, 17.5886, 24.9276, 23.7584, 25.4463, 22.1225, 39.3248, 22.9875, 25.5645, 20.0357, 13.0139, 25.9793, 28.9481, 22.2428, 21.1638, 53.0539, 21.5807, 13.1218, 17.1325, 22.7376, 23.0838, 25.1158, 10.1962, 27.1543, 30.2648, 24.4773, 16.4467, 24.4807, 20.2067, 37.2681, 22.6688, 27.84, 22.2403, 27.2153, 27.4509, 25.2586, 25.5452, 23.2986, 20.0243, 21.6128, 19.492, 26.8405, 28.7693, 20.8667, 21.9913, 18.2508, 24.2434, 33.2813, 35.2585, 31.9638, 31.384, 16.4145, 37.5813, 20.2896, 24.4331, 25.5438, 19.4923, 25.7843, 30.357, 19.3391, 28.772, 21.3621, 17.2257, 29.7053, 32.0533, 22.9202, 16.2692, 28.4794, 26.8873, 19.6306, 24.0756, 18.7401, 56.4427, 24.6569, 31.1585, 26.3857, 18.1243, 18.8188, 28.8209, 20.2321, 33.9169, 22.4066, 22.2148, 26.119, 27.1116, 17.79, 24.8289, 30.4286, 15.2343, 19.4151, 26.5812, 20.3036, 26.5968, 18.9219, 23.8455, 24.8341, 20.5426, 21.1659, 25.9339, 24.9957, 21.6383, 25.5049, 26.1855, 18.428, 24.0974, 30.4544, 28.0616, 14.9419, 26.3196, 35.6184, 27.0066, 22.5896, 36.4091, 22.1126, 24.3329, 13.7785, 23.919, 20.5491, 21.8223, 23.7083, 23.6056, 28.5418, 40.0286, 38.4837, 24.6649, 26.3741, 38.636, 46.303, 21.0658, 20.4775, 23.0115, 23.8991, 11.9236, 31.3516, 12.3884, 26.9624, 11.3389, 12.1705, 23.7058, 22.8612, 23.9386, 45.5946, 15.8352, 27.7927, 28.0948, 27.1822, 29.2885, 24.7749, 23.5254, 26.7659, 17.1524, 36.3302, 18.1723, 42.6678, 19.1597, 26.831, 24.8806, 20.6116, 23.6786, 24.0922, 52.0475, 21.7791, 25.7182, 21.4559, 14.3898, 26.5063, 25.77, 34.1317, 20.3243, 42.0582, 21.9262, 19.2948, 23.4323, 20.7888, 31.0538, 25.1312, 24.1526, 20.6373, 29.117, 22.7518, 20.1977, 17.8174, 23.9983, 16.6097, 34.7053, 25.2611, 21.2185, 21.4091, 24.0699, 19.6319, 18.8549, 23.3562, 7.6885, 29.2224, 26.8566, 17.6114, 25.4844, 30.1161, 33.03, 23.6763, 25.9103, 20.1164, 2.5128, 33.23, 18.7962, 15.1485, 32.1613, 27.5261, 34.8421, 20.6495, 22.9872, 22.2205, 12.9115, 41.5868, 20.9851, 19.9477, 16.7527, 27.8984, 26.1862, 21.4377, 21.9346, 40.6846, 32.3912, 24.4084, 26.4976, 31.0957, 15.836, 22.0949, 44.8355, 29.2075, 23.7593, 12.6029, 25.0325, 39.4402, 72, 21.8894, 25.4112, 24.0392, 1.3538, 19.6852, 23.4342, 21.823, 21.526, 23.2412, 23.5911, 23.9623, 19.5493, 20.53, 22.7291, 27.1576, 11.2191, 20.0724, 23.9767, 28.0438, 27.7875, 24.015, 30.7384, 15.3939, 21.3721, 21.643, 21.021, 27.209, 33.2413, 24.9786, 23.4169, 19.991, 26.4605, 18.2094, 23.2188, 17.7504, 23.9474, 27.1179, 26.0111, 22.4232, 36.4493, 22.1353, 50.0368, 23.5179, 38.8783, 14.7259, 20.4645, 22.4477, 17.6468, 20.4289, 28.6547, 26.4886, 24.814, 15.2443, 13.6867, 21.7637, 21.8037, 20.3492, 17.6666, 31.1278, 20.3907, 20.474, 22.469, 34.2835, 21.7058, 32.2373, 33.3061, 22.5832, 19.5181, 25.1173, 23.75, 22.2458, 25.6717, 27.5453, 16.8359, 35.6651, 19.9762, 19.8119, 26.1862, 37.3281, 18.5304, 19.3331, 24.1851, 30.3747, 24.4478, 44.4784, 53.7222, 29.6609, 17.8575, 22.7644, 20.0677, 38.5642, 27.1584, 21.7535, 30.5, 16.5668 ], "y": [ "ABE", "ABI", "ABQ", "ABR", "ABY", "ACK", "ACT", "ACV", "ACY", "ADK", "ADQ", "AEX", "AGS", "AKN", "ALB", "ALO", "AMA", "ANC", "APN", "ART", "ASE", "ATL", "ATW", "AUS", "AVL", "AVP", "AZA", "AZO", "BDL", "BET", "BFF", "BFL", "BGM", "BGR", "BHM", "BIL", "BIS", "BJI", "BKG", "BLI", "BLV", "BMI", "BNA", "BOI", "BOS", "BPT", "BQK", "BQN", "BRD", "BRO", "BRW", "BTM", "BTR", "BTV", "BUF", "BUR", "BWI", "BZN", "CAE", "CAK", "CDC", "CDV", "CEC", "CGI", "CHA", "CHO", "CHS", "CIC", "CID", "CIU", "CKB", "CLD", "CLE", "CLL", "CLT", "CMH", "CMI", "CMX", "CNY", "COD", "COS", "COU", "CPR", "CRP", "CRW", "CSG", "CVG", "CWA", "CYS", "DAB", "DAL", "DAY", "DBQ", "DCA", "DEN", "DFW", "DHN", "DIK", "DLG", "DLH", "DRO", "DRT", "DSM", "DTW", "DVL", "EAR", "EAU", "ECP", "EGE", "EKO", "ELM", "ELP", "ERI", "ESC", "EUG", "EVV", "EWN", "EWR", "EYW", "FAI", "FAR", "FAT", "FAY", "FCA", "FLG", "FLL", "FLO", "FNT", "FOE", "FSD", "FSM", "FWA", "GCC", "GCK", "GEG", "GFK", "GGG", "GJT", "GNV", "GPT", "GRB", "GRI", "GRK", "GRR", "GSO", "GSP", "GST", "GTF", "GTR", "GUC", "GUM", "HDN", "HGR", "HHH", "HIB", "HLN", "HNL", "HOB", "HOU", "HPN", "HRL", "HSV", "HTS", "HVN", "HYA", "HYS", "IAD", "IAG", "IAH", "ICT", "IDA", "IFP", "ILG", "ILM", "IMT", "IND", "INL", "IPL", "ISN", "ISP", "ITH", "ITO", "IYK", "JAC", "JAN", "JAX", "JFK", "JLN", "JMS", "JNU", "KOA", "KTN", "LAN", "LAR", "LAS", "LAW", "LAX", "LBB", "LBE", "LBF", "LBL", "LCH", "LCK", "LEX", "LFT", "LGA", "LGB", "LIH", "LIT", "LMT", "LNK", "LRD", "LSE", "LWB", "LWS", "LYH", "MAF", "MBS", "MCI", "MCO", "MDT", "MDW", "MEI", "MEM", "MFE", "MFR", "MGM", "MHK", "MHT", "MIA", "MKE", "MKG", "MLB", "MLI", "MLU", "MMH", "MOB", "MOD", "MOT", "MQT", "MRY", "MSN", "MSO", "MSP", "MSY", "MTJ", "MVY", "MWH", "MYR", "OAJ", "OAK", "OGD", "OGG", "OGS", "OKC", "OMA", "OME", "ONT", "ORD", "ORF", "ORH", "OTH", "OTZ", "OWB", "OXR", "PAH", "PBG", "PBI", "PDX", "PFN", "PGD", "PGV", "PHF", "PHL", "PHX", "PIA", "PIB", "PIE", "PIH", "PIR", "PIT", "PLN", "PNS", "PPG", "PRC", "PSC", "PSE", "PSG", "PSM", "PSP", "PUB", "PVD", "PVU", "PWM", "RAP", "RDD", "RDM", "RDU", "RFD", "RHI", "RIC", "RKS", "RNO", "ROA", "ROC", "ROW", "RST", "RSW", "SAF", "SAN", "SAT", "SAV", "SBA", "SBN", "SBP", "SCC", "SCE", "SCK", "SDF", "SEA", "SFB", "SFO", "SGF", "SGU", "SHD", "SHV", "SIT", "SJC", "SJT", "SJU", "SLC", "SLN", "SMF", "SMX", "SNA", "SPI", "SPN", "SPS", "SRQ", "STC", "STL", "STS", "STT", "STX", "SUN", "SUX", "SWF", "SWO", "SYR", "TEX", "TLH", "TOL", "TPA", "TRI", "TTN", "TUL", "TUS", "TVC", "TWF", "TXK", "TYR", "TYS", "UIN", "USA", "UST", "UTM", "VEL", "VLD", "VPS", "WRG", "WYS", "XNA", "YAK", "YNG", "YUM" ] }, { "marker": { "color": "rgba(255, 255, 0, 0.95)", "line": { "color": "rgba(156, 165, 196, 1.0)", "width": 1 }, "opacity": 0.6, "size": 6.5, "symbol": "circle" }, "mode": "markers", "name": "Percent of flights delayed due to Security", "type": "scatter", "uid": "455382cf-9663-4c11-b138-c9c9b3672c65", "x": [ 0.0904, 0.2497, 0.2723, 0, 0.1066, 0.145, 0.1174, 0.0145, 0.3208, 0.6937, 0.1587, 0.1463, 0.0594, 0, 0.2014, 0, 0.2362, 1.6537, 0.1972, 0, 0.1784, 0.0912, 0.0666, 0.2412, 0.1299, 0.159, 0.9877, 0.0361, 0.195, 0.0874, 0, 0.1755, 0.1078, 0.1412, 0.2027, 0.0541, 0.0848, 0.1859, 0, 0.1354, 0.4024, 0.0558, 0.2515, 0.1989, 0.1379, 0.3353, 0.0084, 0.4608, 0, 0.1496, 1.0581, 0.0711, 0.1013, 0.0734, 0.216, 0.2498, 0.2835, 0.0734, 0.0972, 0.088, 0.1661, 0.0957, 0.1059, 0, 0.0673, 0.0708, 0.1907, 0, 0.0911, 0.3473, 0, 0.1349, 0.122, 0.1107, 0.2183, 0.1637, 0, 0.0925, 0, 0.0729, 0.1736, 0.0522, 0.1215, 0.1123, 0.0944, 0.0419, 0.1161, 0.169, 0, 0.1444, 0.251, 0.1111, 0, 0.1706, 0.1773, 0.1499, 0.1184, 0, 0, 0.0835, 0.3102, 0, 0.1337, 0.1556, 0.2193, 0, 0, 0.1468, 0.0694, 0.09, 0.129, 0.2535, 0.0043, 0, 0.0701, 0.0819, 0.067, 0.0936, 0.0871, 0.523, 0.0704, 0.1432, 0.1326, 0.1331, 0.9912, 0.318, 0, 0.0688, 0, 0.0745, 0.1149, 0.1217, 0.0881, 0.4024, 0.1874, 0.2249, 0.3463, 0.2398, 0.0878, 0.1318, 0.098, 0, 0.157, 0.1281, 0.0993, 0.1068, 0, 0.0823, 0.0282, 0.0627, 0, 0.1469, 0, 0.4954, 0, 0.0772, 0.2308, 0, 0.3001, 0.1687, 0.0844, 0.131, 0.3584, 0.4439, 0, 0.1789, 0.1082, 0.9914, 0.1564, 0.1173, 0.0798, 0, 0, 0.0817, 0, 0.1503, 0.211, 0, 0.0502, 0.2606, 0.0649, 0.2691, 0, 0.1073, 0.213, 0.2466, 0.1973, 0.1126, 0.2336, 1.138, 0.1535, 0.3146, 0.1153, 0.1043, 0.2719, 0.0581, 0.2256, 0.1959, 0.5161, 0, 0, 0.1248, 0.562, 0.1597, 0.1258, 0.0977, 0.1878, 0.2744, 0.1987, 0.104, 0.1197, 0.2434, 0.0889, 0, 0.0692, 0, 0.2476, 0.1253, 0.239, 0.2727, 0.1191, 0.3708, 0.0176, 0.1809, 0.2481, 0.0343, 0.0904, 0.0854, 0.2092, 0.2213, 0.1568, 0, 0.0277, 0.157, 0.0816, 0, 0.1198, 0.0449, 0.0545, 0, 0.2707, 0.0638, 0.0676, 0.1634, 0.2303, 0.1485, 0.2379, 0, 0.3391, 0.14, 0.2741, 0, 0.2341, 0, 0.1833, 0.1779, 1.5496, 0.2874, 0.0987, 0.145, 0.2469, 0.0185, 0.8968, 0, 0, 0.0671, 0.8389, 0.2419, 0.2843, 0.0583, 0.349, 0.0232, 0.0328, 0.1856, 0.3084, 0.0503, 0, 0.3076, 0.0479, 0, 0.191, 0.6939, 0.1462, 0.8231, 0, 0.0967, 0.3382, 0.6081, 1.5765, 0.2165, 0.3068, 0.2732, 1.0872, 0.1647, 0.0349, 0.0631, 0.1027, 0.1925, 0.8774, 0, 0.1462, 0.1016, 0.2194, 0.0799, 0.1246, 0.264, 0.0248, 0.1852, 0.128, 0.2267, 0.2752, 0.0845, 0.1781, 0.0563, 0.1622, 0, 0.1013, 0.3586, 0.1606, 0.3196, 0.5713, 0.1192, 0.1418, 0.0992, 0, 0.0472, 0.1271, 0.2135, 0.2637, 0.4048, 0.2015, 0, 0.2151, 0.1499, 0.1909, 0.2322, 0, 0.3294, 0.1495, 0, 0.2519, 0.2425, 0.4358, 0.6204, 0.078, 0, 0.2685, 0, 0.1394, 0, 0.1229, 0, 0.2543, 0.0685, 0, 0.1362, 0.2596, 0.0908, 0.117, 0.0508, 0.0928, 0.0583, 0, 0, 0, 0, 0, 0.0526, 0.1067, 0.3102, 0.4717, 0.1322, 1.4608, 0, 0.5345 ], "y": [ "ABE", "ABI", "ABQ", "ABR", "ABY", "ACK", "ACT", "ACV", "ACY", "ADK", "ADQ", "AEX", "AGS", "AKN", "ALB", "ALO", "AMA", "ANC", "APN", "ART", "ASE", "ATL", "ATW", "AUS", "AVL", "AVP", "AZA", "AZO", "BDL", "BET", "BFF", "BFL", "BGM", "BGR", "BHM", "BIL", "BIS", "BJI", "BKG", "BLI", "BLV", "BMI", "BNA", "BOI", "BOS", "BPT", "BQK", "BQN", "BRD", "BRO", "BRW", "BTM", "BTR", "BTV", "BUF", "BUR", "BWI", "BZN", "CAE", "CAK", "CDC", "CDV", "CEC", "CGI", "CHA", "CHO", "CHS", "CIC", "CID", "CIU", "CKB", "CLD", "CLE", "CLL", "CLT", "CMH", "CMI", "CMX", "CNY", "COD", "COS", "COU", "CPR", "CRP", "CRW", "CSG", "CVG", "CWA", "CYS", "DAB", "DAL", "DAY", "DBQ", "DCA", "DEN", "DFW", "DHN", "DIK", "DLG", "DLH", "DRO", "DRT", "DSM", "DTW", "DVL", "EAR", "EAU", "ECP", "EGE", "EKO", "ELM", "ELP", "ERI", "ESC", "EUG", "EVV", "EWN", "EWR", "EYW", "FAI", "FAR", "FAT", "FAY", "FCA", "FLG", "FLL", "FLO", "FNT", "FOE", "FSD", "FSM", "FWA", "GCC", "GCK", "GEG", "GFK", "GGG", "GJT", "GNV", "GPT", "GRB", "GRI", "GRK", "GRR", "GSO", "GSP", "GST", "GTF", "GTR", "GUC", "GUM", "HDN", "HGR", "HHH", "HIB", "HLN", "HNL", "HOB", "HOU", "HPN", "HRL", "HSV", "HTS", "HVN", "HYA", "HYS", "IAD", "IAG", "IAH", "ICT", "IDA", "IFP", "ILG", "ILM", "IMT", "IND", "INL", "IPL", "ISN", "ISP", "ITH", "ITO", "IYK", "JAC", "JAN", "JAX", "JFK", "JLN", "JMS", "JNU", "KOA", "KTN", "LAN", "LAR", "LAS", "LAW", "LAX", "LBB", "LBE", "LBF", "LBL", "LCH", "LCK", "LEX", "LFT", "LGA", "LGB", "LIH", "LIT", "LMT", "LNK", "LRD", "LSE", "LWB", "LWS", "LYH", "MAF", "MBS", "MCI", "MCO", "MDT", "MDW", "MEI", "MEM", "MFE", "MFR", "MGM", "MHK", "MHT", "MIA", "MKE", "MKG", "MLB", "MLI", "MLU", "MMH", "MOB", "MOD", "MOT", "MQT", "MRY", "MSN", "MSO", "MSP", "MSY", "MTJ", "MVY", "MWH", "MYR", "OAJ", "OAK", "OGD", "OGG", "OGS", "OKC", "OMA", "OME", "ONT", "ORD", "ORF", "ORH", "OTH", "OTZ", "OWB", "OXR", "PAH", "PBG", "PBI", "PDX", "PFN", "PGD", "PGV", "PHF", "PHL", "PHX", "PIA", "PIB", "PIE", "PIH", "PIR", "PIT", "PLN", "PNS", "PPG", "PRC", "PSC", "PSE", "PSG", "PSM", "PSP", "PUB", "PVD", "PVU", "PWM", "RAP", "RDD", "RDM", "RDU", "RFD", "RHI", "RIC", "RKS", "RNO", "ROA", "ROC", "ROW", "RST", "RSW", "SAF", "SAN", "SAT", "SAV", "SBA", "SBN", "SBP", "SCC", "SCE", "SCK", "SDF", "SEA", "SFB", "SFO", "SGF", "SGU", "SHD", "SHV", "SIT", "SJC", "SJT", "SJU", "SLC", "SLN", "SMF", "SMX", "SNA", "SPI", "SPN", "SPS", "SRQ", "STC", "STL", "STS", "STT", "STX", "SUN", "SUX", "SWF", "SWO", "SYR", "TEX", "TLH", "TOL", "TPA", "TRI", "TTN", "TUL", "TUS", "TVC", "TWF", "TXK", "TYR", "TYS", "UIN", "USA", "UST", "UTM", "VEL", "VLD", "VPS", "WRG", "WYS", "XNA", "YAK", "YNG", "YUM" ] }, { "marker": { "color": "rgba(255, 144,144, 0.95)", "line": { "color": "rgba(255, 144, 144, 1.0)", "width": 1 }, "opacity": 0.6, "size": 6.5, "symbol": "circle" }, "mode": "markers", "name": "Percent of flights delayed due to Late Aircraft", "type": "scatter", "uid": "a3c75390-d9c8-49a1-8e4b-e218e101a19f", "x": [ 32.842, 32.8198, 44.4745, 31.4206, 39.1105, 23.2303, 36.8503, 61.0527, 27.2487, 25.8111, 18.4247, 34.8043, 36.1262, 33.48, 37.0455, 34.2262, 40.5145, 31.9287, 41.2975, 28.8621, 33.6114, 36.6667, 33.6046, 38.5185, 36.0865, 36.614, 46.2684, 31.0758, 36.7786, 27.0399, 44.6439, 49.8132, 27.0068, 31.3578, 37.9466, 33.3571, 34.9343, 28.3301, 38.7166, 32.1309, 29.6243, 34.1223, 42.0185, 47.9475, 33.0656, 38.6753, 37.2969, 29.9532, 34.7265, 34.8936, 49.5236, 15.8019, 33.5398, 33.6797, 37.481, 53.8611, 42.8768, 31.3441, 35.6266, 45.0063, 19.1501, 50.0632, 66.3255, 56.4217, 36.4713, 38.0549, 32.8244, 68.8255, 31.5305, 29.9418, 40.4332, 55.1186, 41.9909, 35.0528, 32.6838, 38.4437, 32.9321, 42.2407, 26.1458, 35.5752, 37.176, 34.4586, 34.5593, 39.3405, 37.8019, 35.7641, 34.6897, 33.344, 24.9037, 31.044, 52.6811, 37.428, 29.7299, 32.1315, 39.9928, 41.0877, 39.1807, 29.6606, 38.2148, 34.6034, 31.8623, 49.649, 34.2288, 38.1362, 46.0594, 37.6963, 43.2245, 39.624, 23.5171, 26.7521, 30.2247, 44.8117, 30.2992, 32.9803, 48.6702, 34.067, 39.5721, 24.2266, 29.4258, 29.0873, 35.3109, 49.0505, 34.4122, 31.493, 29.702, 32.1325, 40.3741, 37.9516, 47.2863, 34.5004, 34.6119, 37.1365, 32.8959, 37.5832, 42.0562, 30.6156, 32.1109, 30.4698, 34.731, 33.1686, 34.7678, 34.8354, 31.7956, 32.7563, 33.7898, 36.5334, 47.6907, 35.658, 37.4542, 25.3742, 30.6438, 30.7786, 23.4801, 46.6853, 24.1098, 37.0502, 31.4229, 26.5979, 46.2536, 32.769, 49.9998, 33.0539, 31.9259, 45.692, 32.1111, 43.6621, 38.7488, 24.2857, 34.5823, 35.7558, 35.8004, 19.5195, 33.0576, 35.6554, 44.971, 38.1133, 49.174, 58.1914, 34.5462, 48.8828, 28.0435, 36.1922, 53.2189, 31.8828, 32.4771, 34.803, 28.6966, 42.5542, 33.9093, 35.4626, 28.657, 31.7726, 34.7777, 35.7651, 42.6081, 37.9711, 34.8497, 42.0334, 32.0283, 42.0564, 50.9078, 33.5839, 38.5455, 33.9175, 33.049, 24.2203, 46.7525, 29.346, 36.3611, 56.2297, 38.718, 32.4704, 29.103, 36.424, 15.3748, 39.1557, 41.976, 33.3799, 40.6984, 34.8115, 31.8276, 45.3985, 43.1635, 33.9164, 33.9581, 50.0306, 36.9818, 33.6186, 42.8932, 30.9948, 41.5067, 41.5648, 32.5638, 33.2301, 38.2662, 39.8796, 33.3039, 72.2009, 33.9939, 41.3627, 54.0196, 34.2596, 31.8538, 34.9244, 37.6898, 28.1461, 33.2208, 80.0594, 28.1738, 34.1844, 54.6559, 25.5806, 24.7353, 6.3158, 38.4725, 37.7027, 39.7666, 51.1452, 36.1716, 36.017, 27.7918, 59.707, 28.3667, 45.2937, 52.7566, 49.1128, 23.2195, 30.0507, 41.7593, 35.1986, 42.6333, 38.98, 41.3297, 26.8045, 38.8994, 37.5531, 69.3966, 45.7275, 23.3186, 0, 37.615, 27.3988, 33.2118, 1.1, 52.037, 41.1894, 34.5296, 50.3231, 37.108, 43.1499, 32.3772, 40.1136, 32.8868, 36.2173, 33.4094, 66.6026, 48.8216, 36.3708, 30.0095, 31.4291, 36.5709, 28.7789, 49.1426, 32.9714, 37.2101, 30.7191, 31.8264, 29.0755, 30.3568, 41.9518, 39.2957, 32.1614, 51.3876, 39.4539, 52.2518, 31.8543, 32.9561, 41.8018, 37.5024, 32.4516, 48.1199, 29.6751, 33.557, 28.9099, 57.1689, 36.055, 45.544, 50.8677, 35.0671, 25.411, 41.4095, 47.3767, 51.7779, 57.8295, 42.3504, 40.4298, 10.9293, 34.786, 28.6954, 49.6589, 43.2829, 49.0713, 19.2845, 25.8973, 25.7156, 32.4027, 31.8488, 35.3279, 32.3614, 9.0312, 31.4272, 35.1484, 36.0278, 37.0254, 43.3244, 38.1647, 42.7313, 31.8352, 25.1865, 33.0111, 35.7789, 35.2524, 36.6681, 39.7671, 33.3102, 10.7778, 23.9071, 38.2759, 33.095, 51.2064, 14.8201, 32.4784, 56.7812, 0, 39.6588 ], "y": [ "ABE", "ABI", "ABQ", "ABR", "ABY", "ACK", "ACT", "ACV", "ACY", "ADK", "ADQ", "AEX", "AGS", "AKN", "ALB", "ALO", "AMA", "ANC", "APN", "ART", "ASE", "ATL", "ATW", "AUS", "AVL", "AVP", "AZA", "AZO", "BDL", "BET", "BFF", "BFL", "BGM", "BGR", "BHM", "BIL", "BIS", "BJI", "BKG", "BLI", "BLV", "BMI", "BNA", "BOI", "BOS", "BPT", "BQK", "BQN", "BRD", "BRO", "BRW", "BTM", "BTR", "BTV", "BUF", "BUR", "BWI", "BZN", "CAE", "CAK", "CDC", "CDV", "CEC", "CGI", "CHA", "CHO", "CHS", "CIC", "CID", "CIU", "CKB", "CLD", "CLE", "CLL", "CLT", "CMH", "CMI", "CMX", "CNY", "COD", "COS", "COU", "CPR", "CRP", "CRW", "CSG", "CVG", "CWA", "CYS", "DAB", "DAL", "DAY", "DBQ", "DCA", "DEN", "DFW", "DHN", "DIK", "DLG", "DLH", "DRO", "DRT", "DSM", "DTW", "DVL", "EAR", "EAU", "ECP", "EGE", "EKO", "ELM", "ELP", "ERI", "ESC", "EUG", "EVV", "EWN", "EWR", "EYW", "FAI", "FAR", "FAT", "FAY", "FCA", "FLG", "FLL", "FLO", "FNT", "FOE", "FSD", "FSM", "FWA", "GCC", "GCK", "GEG", "GFK", "GGG", "GJT", "GNV", "GPT", "GRB", "GRI", "GRK", "GRR", "GSO", "GSP", "GST", "GTF", "GTR", "GUC", "GUM", "HDN", "HGR", "HHH", "HIB", "HLN", "HNL", "HOB", "HOU", "HPN", "HRL", "HSV", "HTS", "HVN", "HYA", "HYS", "IAD", "IAG", "IAH", "ICT", "IDA", "IFP", "ILG", "ILM", "IMT", "IND", "INL", "IPL", "ISN", "ISP", "ITH", "ITO", "IYK", "JAC", "JAN", "JAX", "JFK", "JLN", "JMS", "JNU", "KOA", "KTN", "LAN", "LAR", "LAS", "LAW", "LAX", "LBB", "LBE", "LBF", "LBL", "LCH", "LCK", "LEX", "LFT", "LGA", "LGB", "LIH", "LIT", "LMT", "LNK", "LRD", "LSE", "LWB", "LWS", "LYH", "MAF", "MBS", "MCI", "MCO", "MDT", "MDW", "MEI", "MEM", "MFE", "MFR", "MGM", "MHK", "MHT", "MIA", "MKE", "MKG", "MLB", "MLI", "MLU", "MMH", "MOB", "MOD", "MOT", "MQT", "MRY", "MSN", "MSO", "MSP", "MSY", "MTJ", "MVY", "MWH", "MYR", "OAJ", "OAK", "OGD", "OGG", "OGS", "OKC", "OMA", "OME", "ONT", "ORD", "ORF", "ORH", "OTH", "OTZ", "OWB", "OXR", "PAH", "PBG", "PBI", "PDX", "PFN", "PGD", "PGV", "PHF", "PHL", "PHX", "PIA", "PIB", "PIE", "PIH", "PIR", "PIT", "PLN", "PNS", "PPG", "PRC", "PSC", "PSE", "PSG", "PSM", "PSP", "PUB", "PVD", "PVU", "PWM", "RAP", "RDD", "RDM", "RDU", "RFD", "RHI", "RIC", "RKS", "RNO", "ROA", "ROC", "ROW", "RST", "RSW", "SAF", "SAN", "SAT", "SAV", "SBA", "SBN", "SBP", "SCC", "SCE", "SCK", "SDF", "SEA", "SFB", "SFO", "SGF", "SGU", "SHD", "SHV", "SIT", "SJC", "SJT", "SJU", "SLC", "SLN", "SMF", "SMX", "SNA", "SPI", "SPN", "SPS", "SRQ", "STC", "STL", "STS", "STT", "STX", "SUN", "SUX", "SWF", "SWO", "SYR", "TEX", "TLH", "TOL", "TPA", "TRI", "TTN", "TUL", "TUS", "TVC", "TWF", "TXK", "TYR", "TYS", "UIN", "USA", "UST", "UTM", "VEL", "VLD", "VPS", "WRG", "WYS", "XNA", "YAK", "YNG", "YUM" ] } ], "layout": { "height": 600, "hovermode": "closest", "legend": { "font": { "size": 10 }, "xanchor": "right", "yanchor": "middle" }, "margin": { "b": 50, "l": 140, "r": 40, "t": 80 }, "paper_bgcolor": "white", "plot_bgcolor": "white", "title": { "text": "% of Delay Reasons at Airports" }, "width": 800, "xaxis": { "dtick": 10, "linecolor": "rgb(102, 102, 102)", "showgrid": false, "showline": true, "showticklabels": true, "tickcolor": "rgb(102, 102, 102)", "tickfont": { "color": "rgb(102, 102, 102)" }, "ticks": "outside" }, "yaxis": { "title": { "text": "Airport" } } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "airports = list(df_dotplot.index)\n", "carrier_delay = list(round((df_dotplot['Carrier']/df_dotplot['Sum of Total Flights Delayed'])*100,4))\n", "weather_delay = list(round((df_dotplot['Weather']/df_dotplot['Sum of Total Flights Delayed'])*100,4))\n", "nas_delay = list(round((df_dotplot['National Air System']/df_dotplot['Sum of Total Flights Delayed'])*100,4))\n", "security_delay = list(round((df_dotplot['Security']/df_dotplot['Sum of Total Flights Delayed'])*100,4))\n", "lateaircraft_delay = list(round((df_dotplot['Late Aircraft']/df_dotplot['Sum of Total Flights Delayed'])*100,4))\n", "\n", "fig = go.Figure()\n", "\n", "fig.add_trace(go.Scatter(\n", " x=carrier_delay,\n", " y= airports,\n", " name='Percent of flights delayed due to Carrier',\n", " marker=dict(\n", " color='rgba(0, 0, 255, 0.95)',\n", " line_color='rgba(156, 165, 196, 1.0)',\n", " )\n", "))\n", "\n", "fig.add_trace(go.Scatter(\n", " x=weather_delay,\n", " y= airports,\n", " name='Percent of flights delayed due to Weather',\n", " marker=dict(\n", " color='rgba(0, 255, 0, 0.95)',\n", " line_color='rgba(217, 217, 217, 1.0)'\n", " )\n", "))\n", "\n", "fig.add_trace(go.Scatter(\n", " x=nas_delay,\n", " y= airports,\n", " name='Percent of flights delayed due to National Air System',\n", " marker=dict(\n", " color='rgba(56, 65, 96, 0.95)',\n", " line_color='rgba(56, 65, 96, 1.0)',\n", " )\n", "))\n", "\n", "fig.add_trace(go.Scatter(\n", " x=security_delay,\n", " y= airports,\n", " name='Percent of flights delayed due to Security',\n", " marker=dict(\n", " color='rgba(255, 255, 0, 0.95)',\n", " line_color='rgba(156, 165, 196, 1.0)',\n", " )\n", "))\n", "\n", "fig.add_trace(go.Scatter(\n", " x=lateaircraft_delay,\n", " y= airports,\n", " name='Percent of flights delayed due to Late Aircraft',\n", " marker=dict(\n", " color='rgba(255, 144,144, 0.95)',\n", " line_color='rgba(255, 144, 144, 1.0)',\n", " )\n", "))\n", "\n", "fig.update_traces(mode='markers', marker=dict(line_width=1, symbol='circle', size=6.5, opacity = 0.6))\n", "\n", "fig.layout.update(\n", " title=\"% of Delay Reasons at Airports\",\n", " xaxis=dict(\n", " showgrid=False,\n", " showline=True,\n", " linecolor='rgb(102, 102, 102)',\n", " tickfont_color='rgb(102, 102, 102)',\n", " showticklabels=True,\n", " dtick=10,\n", " ticks='outside',\n", " tickcolor='rgb(102, 102, 102)',\n", " ),\n", " yaxis = dict(title = 'Airport'),\n", " margin=dict(l=140, r=40, b=50, t=80),\n", " legend=dict(\n", " font_size=10,\n", " yanchor='middle',\n", " xanchor='right',\n", " ),\n", " width=800,\n", " height=600,\n", " paper_bgcolor='white',\n", " plot_bgcolor='white',\n", " hovermode='closest',\n", ")\n", "fig.show()\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This is a little too congested. We were trying to fit in data of 375 airports. But, we can get a fair idea of what does cause the most delay. - We can see a lot of pink, blue and grey dots which shows that the main reasons for delay are Late Aircraft, Carrier and National Air Systems. \n", "\n", "### Let's do the same but for the Top 25 airports (with respect to the delay)" ] }, { "cell_type": "code", "execution_count": 161, "metadata": {}, "outputs": [], "source": [ "#Let's find out about the top 25 airports which have the most delay. \n", "top25_df_dotplot = df_dotplot.sort_values(by=['Sum of Total Flights Delayed'], ascending = False).iloc[:25,:]" ] }, { "cell_type": "code", "execution_count": 162, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "marker": { "color": "rgba(0, 0, 255, 0.95)", "line": { "color": "rgba(156, 165, 196, 1.0)", "width": 1 }, "opacity": 0.99, "size": 6.5, "symbol": "circle" }, "mode": "markers", "name": "Percent of flights delayed due to Carrier", "type": "scatter", "uid": "5448d698-79a8-4a13-aa76-069e9d95d715", "x": [ 22.8799, 19.3986, 23.463, 25.916, 17.5509, 24.9884, 16.437, 23.6567, 29.4538, 27.8256, 19.8916, 25.9619, 31.3019, 22.9836, 26.936, 27.992, 28.2045, 28.149, 27.258, 24.4463, 31.0817, 29.1531, 26.2706, 28.7731, 31.9533 ], "y": [ "ATL", "ORD", "DFW", "LAX", "SFO", "DEN", "EWR", "IAH", "PHX", "LAS", "LGA", "BOS", "MCO", "JFK", "CLT", "DTW", "MSP", "SEA", "BWI", "PHL", "FLL", "SLC", "MDW", "DCA", "SAN" ] }, { "marker": { "color": "rgba(0, 255, 0, 0.95)", "line": { "color": "rgba(217, 217, 217, 1.0)", "width": 1 }, "opacity": 0.99, "size": 6.5, "symbol": "circle" }, "mode": "markers", "name": "Percent of flights delayed due to Weather", "type": "scatter", "uid": "0e540c6f-6eac-48dd-91c2-d34b4834446f", "x": [ 2.7785, 2.7443, 3.9155, 2.6785, 2.6181, 2.8777, 2.8, 3.121, 2.131, 2.5285, 3.7428, 2.9681, 2.5602, 2.528, 2.8938, 3.3591, 3.6776, 2.6305, 3.6025, 3.7282, 2.5508, 2.7474, 3.8076, 3.6664, 2.4512 ], "y": [ "ATL", "ORD", "DFW", "LAX", "SFO", "DEN", "EWR", "IAH", "PHX", "LAS", "LGA", "BOS", "MCO", "JFK", "CLT", "DTW", "MSP", "SEA", "BWI", "PHL", "FLL", "SLC", "MDW", "DCA", "SAN" ] }, { "marker": { "color": "rgba(255, 128, 0, 0.95)", "line": { "color": "rgba(255, 128, 0 1.0)", "width": 1 }, "opacity": 0.99, "size": 6.5, "symbol": "circle" }, "mode": "markers", "name": "Percent of flights delayed due to National Air System", "type": "scatter", "uid": "c0bf9fb9-24b9-4a57-bed0-0af0d6a0b664", "x": [ 37.5837, 41.5868, 31.384, 36.3302, 50.0368, 31.9638, 56.4427, 38.4837, 29.2075, 26.7659, 52.0475, 37.8666, 31.0538, 45.5946, 37.2681, 30.357, 33.03, 36.4493, 25.9793, 44.8355, 33.9169, 26.4886, 24.1526, 35.2585, 23.4169 ], "y": [ "ATL", "ORD", "DFW", "LAX", "SFO", "DEN", "EWR", "IAH", "PHX", "LAS", "LGA", "BOS", "MCO", "JFK", "CLT", "DTW", "MSP", "SEA", "BWI", "PHL", "FLL", "SLC", "MDW", "DCA", "SAN" ] }, { "marker": { "color": "rgba(255, 255, 0, 0.95)", "line": { "color": "rgba(156, 165, 196, 1.0)", "width": 1 }, "opacity": 0.99, "size": 6.5, "symbol": "circle" }, "mode": "markers", "name": "Percent of flights delayed due to Security", "type": "scatter", "uid": "bf9aac77-19f1-4432-bb62-8e8d1e46ccd4", "x": [ 0.0912, 0.0987, 0.1499, 0.2256, 0.1192, 0.1773, 0.0936, 0.1564, 0.3084, 0.2719, 0.0977, 0.1379, 0.2727, 0.1973, 0.2183, 0.1556, 0.1634, 0.3196, 0.2835, 0.1856, 0.318, 0.2015, 0.3708, 0.1706, 0.2267 ], "y": [ "ATL", "ORD", "DFW", "LAX", "SFO", "DEN", "EWR", "IAH", "PHX", "LAS", "LGA", "BOS", "MCO", "JFK", "CLT", "DTW", "MSP", "SEA", "BWI", "PHL", "FLL", "SLC", "MDW", "DCA", "SAN" ] }, { "marker": { "color": "rgba(255, 0,255, 0.95)", "line": { "color": "rgba(255, 0,255, 1.0)", "width": 1 }, "opacity": 0.99, "size": 6.5, "symbol": "circle" }, "mode": "markers", "name": "Percent of flights delayed due to Late Aircraft", "type": "scatter", "uid": "93fed7f7-d830-49dd-8b7f-39bb0773fad0", "x": [ 36.6667, 36.1716, 41.0877, 34.8497, 29.6751, 39.9928, 24.2266, 34.5823, 38.8994, 42.6081, 24.2203, 33.0656, 34.8115, 28.6966, 32.6838, 38.1362, 34.9244, 32.4516, 42.8768, 26.8045, 32.1325, 41.4095, 45.3985, 32.1315, 41.9518 ], "y": [ "ATL", "ORD", "DFW", "LAX", "SFO", "DEN", "EWR", "IAH", "PHX", "LAS", "LGA", "BOS", "MCO", "JFK", "CLT", "DTW", "MSP", "SEA", "BWI", "PHL", "FLL", "SLC", "MDW", "DCA", "SAN" ] } ], "layout": { "height": 600, "hovermode": "closest", "legend": { "font": { "size": 10 }, "xanchor": "right", "yanchor": "middle" }, "margin": { "b": 50, "l": 140, "r": 40, "t": 80 }, "paper_bgcolor": "white", "plot_bgcolor": "white", "title": { "text": "% of Delay Reasons at Top 25 Airports" }, "width": 800, "xaxis": { "dtick": 10, "linecolor": "rgb(102, 102, 102)", "showgrid": false, "showline": true, "showticklabels": true, "tickcolor": "rgb(102, 102, 102)", "tickfont": { "color": "rgb(102, 102, 102)" }, "ticks": "outside" }, "yaxis": { "title": { "text": "Airport" } } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "airports3 = list(top25_df_dotplot.index)\n", "carrier_delay3 = list(round((top25_df_dotplot['Carrier']/top25_df_dotplot['Sum of Total Flights Delayed'])*100,4))\n", "weather_delay3 = list(round((top25_df_dotplot['Weather']/top25_df_dotplot['Sum of Total Flights Delayed'])*100,4))\n", "nas_delay3 = list(round((top25_df_dotplot['National Air System']/top25_df_dotplot['Sum of Total Flights Delayed'])*100,4))\n", "security_delay3 = list(round((top25_df_dotplot['Security']/top25_df_dotplot['Sum of Total Flights Delayed'])*100,4))\n", "lateaircraft_delay3 = list(round((top25_df_dotplot['Late Aircraft']/top25_df_dotplot['Sum of Total Flights Delayed'])*100,4))\n", "\n", "fig = go.Figure()\n", "\n", "fig.add_trace(go.Scatter(\n", " x=carrier_delay3,\n", " y= airports3,\n", " name='Percent of flights delayed due to Carrier',\n", " marker=dict(\n", " color='rgba(0, 0, 255, 0.95)',\n", " line_color='rgba(156, 165, 196, 1.0)',\n", " )\n", "))\n", "\n", "fig.add_trace(go.Scatter(\n", " x=weather_delay3,\n", " y= airports3,\n", " name='Percent of flights delayed due to Weather',\n", " marker=dict(\n", " color='rgba(0, 255, 0, 0.95)',\n", " line_color='rgba(217, 217, 217, 1.0)'\n", " )\n", "))\n", "\n", "fig.add_trace(go.Scatter(\n", " x=nas_delay3,\n", " y= airports3,\n", " name='Percent of flights delayed due to National Air System',\n", " marker=dict(\n", " color='rgba(255, 128, 0, 0.95)',\n", " line_color='rgba(255, 128, 0 1.0)',\n", " )\n", "))\n", "\n", "fig.add_trace(go.Scatter(\n", " x=security_delay3,\n", " y= airports3,\n", " name='Percent of flights delayed due to Security',\n", " marker=dict(\n", " color='rgba(255, 255, 0, 0.95)',\n", " line_color='rgba(156, 165, 196, 1.0)',\n", " )\n", "))\n", "\n", "fig.add_trace(go.Scatter(\n", " x=lateaircraft_delay3,\n", " y= airports3,\n", " name='Percent of flights delayed due to Late Aircraft',\n", " marker=dict(\n", " color='rgba(255, 0,255, 0.95)',\n", " line_color='rgba(255, 0,255, 1.0)',\n", " )\n", "))\n", "\n", "fig.update_traces(mode='markers', marker=dict(line_width=1, symbol='circle', size=6.5, opacity = 0.99))\n", "\n", "fig.layout.update(\n", " title=\"% of Delay Reasons at Top 25 Airports\",\n", " xaxis=dict(\n", " showgrid=False,\n", " showline=True,\n", " linecolor='rgb(102, 102, 102)',\n", " tickfont_color='rgb(102, 102, 102)',\n", " showticklabels=True,\n", " dtick=10,\n", " ticks='outside',\n", " tickcolor='rgb(102, 102, 102)',\n", " ),\n", " yaxis = dict(title = 'Airport'),\n", " margin=dict(l=140, r=40, b=50, t=80),\n", " legend=dict(\n", " font_size=10,\n", " yanchor='middle',\n", " xanchor='right',\n", " ),\n", " width=800,\n", " height=600,\n", " paper_bgcolor='white',\n", " plot_bgcolor='white',\n", " hovermode='closest',\n", ")\n", "fig.show()\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Let's try a stacked Bar plot" ] }, { "cell_type": "code", "execution_count": 163, "metadata": { "scrolled": false }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "name": "Carrier Delay", "text": [ "22.8799", "19.3986", "23.463", "25.916", "17.5509", "24.9884", "16.437", "23.6567", "29.4538", "27.8256", "19.8916", "25.9619", "31.3019", "22.9836", "26.936", "27.992", "28.2045", "28.149", "27.258", "24.4463", "31.0817", "29.1531", "26.2706", "28.7731", "31.9533" ], "textposition": "auto", "type": "bar", "uid": "b4becbf0-9e75-4d2c-90cd-12a0154d9efe", "x": [ "ATL", "ORD", "DFW", "LAX", "SFO", "DEN", "EWR", "IAH", "PHX", "LAS", "LGA", "BOS", "MCO", "JFK", "CLT", "DTW", "MSP", "SEA", "BWI", "PHL", "FLL", "SLC", "MDW", "DCA", "SAN" ], "y": [ 151349.57000000012, 118635.69999999988, 106492.93000000008, 110682.74999999999, 73862.08999999984, 100821.07999999997, 52315.61999999993, 69228.77000000002, 79672.27999999991, 73338.20000000006, 51782.289999999935, 65146.10999999994, 74299.01, 53558.47000000001, 58452.39999999996, 57590.24999999998, 56567.38999999989, 53992.86999999996, 47453.48000000001, 41726.62000000007, 48819.31000000001, 44915.55999999994, 39746.85999999999, 43382.560000000034, 46502.57 ] }, { "name": "Weather Delay", "text": [ "2.7785", "2.7443", "3.9155", "2.6785", "2.6181", "2.8777", "2.8", "3.121", "2.131", "2.5285", "3.7428", "2.9681", "2.5602", "2.528", "2.8938", "3.3591", "3.6776", "2.6305", "3.6025", "3.7282", "2.5508", "2.7474", "3.8076", "3.6664", "2.4512" ], "type": "bar", "uid": "759c3d28-84f3-422e-9607-3781cc838394", "x": [ "ATL", "ORD", "DFW", "LAX", "SFO", "DEN", "EWR", "IAH", "PHX", "LAS", "LGA", "BOS", "MCO", "JFK", "CLT", "DTW", "MSP", "SEA", "BWI", "PHL", "FLL", "SLC", "MDW", "DCA", "SAN" ], "y": [ 18379.910000000044, 16783.419999999987, 17771.349999999984, 11439.450000000015, 11018.130000000006, 11610.859999999982, 8911.990000000002, 9133.170000000002, 5764.259999999992, 6664.079999999998, 9743.459999999994, 7447.840000000003, 6076.8600000000015, 5890.990000000001, 6279.640000000004, 6910.979999999987, 7375.910000000002, 5045.639999999999, 6271.539999999991, 6363.470000000006, 4006.5199999999986, 4232.880000000004, 5760.890000000001, 5528.029999999998, 3567.379999999999 ] }, { "name": "National Air System Delay", "text": [ "37.5837", "41.5868", "31.384", "36.3302", "50.0368", "31.9638", "56.4427", "38.4837", "29.2075", "26.7659", "52.0475", "37.8666", "31.0538", "45.5946", "37.2681", "30.357", "33.03", "36.4493", "25.9793", "44.8355", "33.9169", "26.4886", "24.1526", "35.2585", "23.4169" ], "textposition": "inside", "type": "bar", "uid": "e283266e-b6b5-463d-a3b8-7cb6f2a5f6f7", "x": [ "ATL", "ORD", "DFW", "LAX", "SFO", "DEN", "EWR", "IAH", "PHX", "LAS", "LGA", "BOS", "MCO", "JFK", "CLT", "DTW", "MSP", "SEA", "BWI", "PHL", "FLL", "SLC", "MDW", "DCA", "SAN" ], "y": [ 248613.96999999968, 254330.94999999984, 142444.37999999995, 155159.54000000004, 210577.3099999999, 128965.17999999995, 179645.98999999985, 112618.48999999996, 79005.97000000006, 70545.13999999996, 135491.16999999995, 95018.71, 73710.31, 106248.72000000003, 80873.63000000006, 62455.86999999996, 66245.37000000011, 69913.71000000002, 45227.38000000002, 76528.27999999991, 53272.50999999999, 40810.51999999999, 36542.380000000056, 53160.88000000003, 34079.37 ] }, { "name": "Security Delay", "text": [ "0.0912", "0.0987", "0.1499", "0.2256", "0.1192", "0.1773", "0.0936", "0.1564", "0.3084", "0.2719", "0.0977", "0.1379", "0.2727", "0.1973", "0.2183", "0.1556", "0.1634", "0.3196", "0.2835", "0.1856", "0.318", "0.2015", "0.3708", "0.1706", "0.2267" ], "type": "bar", "uid": "5a54a9ba-8882-4e7e-85e3-6028fbf9f817", "x": [ "ATL", "ORD", "DFW", "LAX", "SFO", "DEN", "EWR", "IAH", "PHX", "LAS", "LGA", "BOS", "MCO", "JFK", "CLT", "DTW", "MSP", "SEA", "BWI", "PHL", "FLL", "SLC", "MDW", "DCA", "SAN" ], "y": [ 603.0000000000003, 603.4599999999998, 680.3099999999995, 963.4699999999999, 501.57000000000033, 715.4000000000004, 297.91000000000025, 457.81999999999994, 834.2099999999998, 716.7399999999992, 254.35000000000005, 346, 647.2399999999999, 459.66, 473.7199999999997, 320.1600000000001, 327.75, 613.0899999999993, 493.5199999999998, 316.77000000000004, 499.44999999999976, 310.39, 560.9900000000004, 257.15, 329.9699999999999 ] }, { "name": "Late Aircraft Delay", "text": [ "36.6667", "36.1716", "41.0877", "34.8497", "29.6751", "39.9928", "24.2266", "34.5823", "38.8994", "42.6081", "24.2203", "33.0656", "34.8115", "28.6966", "32.6838", "38.1362", "34.9244", "32.4516", "42.8768", "26.8045", "32.1325", "41.4095", "45.3985", "32.1315", "41.9518" ], "textposition": "inside", "type": "bar", "uid": "23bb89a6-8f77-4769-b072-ecf09149c4ce", "x": [ "ATL", "ORD", "DFW", "LAX", "SFO", "DEN", "EWR", "IAH", "PHX", "LAS", "LGA", "BOS", "MCO", "JFK", "CLT", "DTW", "MSP", "SEA", "BWI", "PHL", "FLL", "SLC", "MDW", "DCA", "SAN" ], "y": [ 242548.0299999998, 221213.60999999978, 186487.15000000046, 148836.7099999999, 124886.00000000016, 161359.71000000002, 77108.57999999996, 101201.44999999998, 105222.44999999994, 112299.24999999988, 63050.940000000024, 82971.43999999996, 82629.53, 66871.47000000006, 70925.50000000017, 78460.67999999998, 70044.93000000011, 62245.680000000015, 74644.19999999995, 45751.74000000003, 50469.760000000024, 63798.78000000004, 68687.02000000002, 48446.22999999999, 61053.82 ] } ], "layout": { "barmode": "stack", "title": { "text": "Casues of Delay at Top 25 Airports
[2009-2019]" }, "xaxis": { "title": { "text": "Airport" } }, "yaxis": { "title": { "text": "Total Delay (in minutes)" } } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig = go.Figure()\n", "fig.add_trace(go.Bar(x=airports3, y=list(top25_df_dotplot['Carrier']), text=carrier_delay3, \n", " textposition = 'auto', name='Carrier Delay'))\n", "fig.add_trace(go.Bar(x=airports3, y=list(top25_df_dotplot['Weather']), text = weather_delay3,name='Weather Delay'))\n", "fig.add_trace(go.Bar(x=airports3, y=list(top25_df_dotplot['National Air System']), \n", " text = nas_delay3, textposition = 'inside', name='National Air System Delay'))\n", "fig.add_trace(go.Bar(x=airports3, y=list(top25_df_dotplot['Security']),text=security_delay3, name='Security Delay'))\n", "fig.add_trace(go.Bar(x=airports3, y=list(top25_df_dotplot['Late Aircraft']), \n", " text = lateaircraft_delay3,textposition = 'inside', name='Late Aircraft Delay'))\n", "\n", "fig.layout.update(barmode='stack', title = \"Casues of Delay at Top 25 Airports
[2009-2019]\",xaxis=dict(title = 'Airport'),\n", " yaxis = dict(title = 'Total Delay (in minutes)'))\n", "fig.show()" ] }, { "cell_type": "code", "execution_count": 164, "metadata": {}, "outputs": [], "source": [ "merged_df2 = pd.merge(top25_df_dotplot, merged_df, how='inner', left_index = True, right_on = 'iata')" ] }, { "cell_type": "code", "execution_count": 165, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "lat": [ 33.64044444, 41.979595, 32.89595056, 33.94253611, 37.61900194, 39.85840806, 40.69249722, 29.98047222, 33.43416667, 36.08036111, 40.77724306, 42.3643475, 28.42888889, 40.63975111, 35.21401111, 42.21205889, 44.88054694, 47.44898194, 39.17540167, 39.87195278, 26.07258333, 40.78838778, 41.7859825, 38.85208333, 32.73355611 ], "locationmode": "USA-states", "lon": [ -84.42694444, -87.90446417, -97.0372, -118.40807439999999, -122.3748433, -104.6670019, -74.16866056, -95.33972222, -112.00805559999999, -115.15233329999998, -73.87260917, -71.00517917, -81.31602778, -73.77892556, -80.94312583, -83.34883583, -93.2169225, -122.30931310000001, -76.66819833, -75.24114083, -80.15275, -111.9777731, -87.75242444, -77.03772222, -117.1896567 ], "marker": { "autocolorscale": false, "cmax": 661494.4799999996, "cmin": 0, "color": [ 661494.4799999996, 611567.1399999995, 453876.12000000046, 427081.9199999999, 420845.0999999999, 403472.2299999999, 318280.08999999973, 292639.69999999995, 270499.16999999987, 263563.4099999999, 260322.2099999999, 250930.09999999992, 237362.94999999998, 233029.3100000001, 217004.89000000022, 205737.9399999999, 200561.35000000012, 191810.99, 174090.12, 170686.88000000003, 157067.55000000002, 154068.12999999998, 151298.14000000007, 150774.85000000003, 145533.11000000002 ], "colorbar": { "title": { "text": "Total flights
Delayed by >15 mins" } }, "colorscale": "Rainbow", "line": { "color": "rgba(205, 102, 102)", "width": 1 }, "opacity": 0.8, "reversescale": true, "size": [ 84.80698461538456, 78.40604358974353, 58.18924615384621, 54.7540923076923, 53.95449999999999, 51.727208974358966, 40.80513974358971, 37.517910256410254, 34.679380769230754, 33.79018076923076, 33.3746423076923, 32.170525641025634, 30.431147435897433, 29.875552564102577, 27.82113974358977, 26.37665897435896, 25.712993589743604, 24.59115256410256, 22.31924615384615, 21.882933333333337, 20.136865384615387, 19.752324358974356, 19.397197435897446, 19.33010897435898, 18.658091025641028 ], "symbol": "circle" }, "mode": "markers", "text": [ "William B Hartsfield-Atlanta Intl, Atlanta, GA,
661494.0 flights delayed", "Chicago O'Hare International, Chicago, IL,
611567.0 flights delayed", "Dallas-Fort Worth International, Dallas-Fort Worth, TX,
453876.0 flights delayed", "Los Angeles International, Los Angeles, CA,
427082.0 flights delayed", "San Francisco International, San Francisco, CA,
420845.0 flights delayed", "Denver Intl, Denver, CO,
403472.0 flights delayed", "Newark Intl, Newark, NJ,
318280.0 flights delayed", "George Bush Intercontinental, Houston, TX,
292640.0 flights delayed", "Phoenix Sky Harbor International, Phoenix, AZ,
270499.0 flights delayed", "McCarran International, Las Vegas, NV,
263563.0 flights delayed", "LaGuardia, New York, NY,
260322.0 flights delayed", "Gen Edw L Logan Intl, Boston, MA,
250930.0 flights delayed", "Orlando International, Orlando, FL,
237363.0 flights delayed", "John F Kennedy Intl, New York, NY,
233029.0 flights delayed", "Charlotte/Douglas International, Charlotte, NC,
217005.0 flights delayed", "Detroit Metropolitan-Wayne County, Detroit, MI,
205738.0 flights delayed", "Minneapolis-St Paul Intl, Minneapolis, MN,
200561.0 flights delayed", "Seattle-Tacoma Intl, Seattle, WA,
191811.0 flights delayed", "Baltimore-Washington International, Baltimore, MD,
174090.0 flights delayed", "Philadelphia Intl, Philadelphia, PA,
170687.0 flights delayed", "Fort Lauderdale-Hollywood Int'l, Ft. Lauderdale, FL,
157068.0 flights delayed", "Salt Lake City Intl, Salt Lake City, UT,
154068.0 flights delayed", "Chicago Midway, Chicago, IL,
151298.0 flights delayed", "Ronald Reagan Washington National, Arlington, VA,
150775.0 flights delayed", "San Diego International-Lindbergh , San Diego, CA,
145533.0 flights delayed" ], "type": "scattergeo", "uid": "3d005b3d-85e4-41c7-8d8d-bb8e0e9275c2" } ], "layout": { "geo": { "countrycolor": "rgb(217, 217, 217)", "countrywidth": 0.5, "landcolor": "rgb(250, 250, 250)", "projection": { "type": "albers usa" }, "scope": "usa", "showland": true, "subunitcolor": "rgb(217, 217, 217)", "subunitwidth": 0.5 }, "title": { "text": "Top 25 Airports with the most delays
(Hover for airport names)" } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "trace = go.Scattergeo(locationmode = 'USA-states',\n", " lon = merged_df2['long'], \n", " lat = merged_df2['lat'], \n", " text= merged_df2['airport'] +\", \"+ merged_df2['city']+ \", \"+ merged_df2['state']+\",
\" + \n", " round(merged_df2['Sum of Total Flights Delayed']).astype(str)+\" flights delayed\",\n", " mode='markers',\n", " marker = dict(size = merged_df2['Sum of Total Flights Delayed']/7800,\n", " opacity = 0.8,\n", " reversescale=True,\n", " autocolorscale = False,\n", " symbol = 'circle',\n", " line = dict(width=1,\n", " color='rgba(205, 102, 102)'),\n", " colorscale = 'Rainbow',\n", " cmin = 0,\n", " color = merged_df2['Sum of Total Flights Delayed'],\n", " cmax = merged_df2['Sum of Total Flights Delayed'].max(),\n", " colorbar_title=\"Total flights
Delayed by >15 mins\"\n", " ))\n", "fig = go.Figure(data = [trace])\n", "\n", "fig.layout.update(\n", " title = 'Top 25 Airports with the most delays
(Hover for airport names)',\n", " geo = dict(\n", " scope='usa',\n", " projection_type='albers usa',\n", " showland = True,\n", " landcolor = \"rgb(250, 250, 250)\",\n", " subunitcolor = \"rgb(217, 217, 217)\",\n", " countrycolor = \"rgb(217, 217, 217)\",\n", " countrywidth = 0.5,\n", " subunitwidth = 0.5\n", " ),\n", " )\n", "fig.show()" ] }, { "cell_type": "code", "execution_count": 166, "metadata": { "scrolled": false }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "name": "% of Carrier Delay", "type": "bar", "uid": "e5020449-41be-4982-a036-d5b5fd6f9d8a", "x": [ "ABE", "ABI", "ABQ", "ABR", "ABY", "ACK", "ACT", "ACV", "ACY", "ADK", "ADQ", "AEX", "AGS", "AKN", "ALB", "ALO", "AMA", "ANC", "APN", "ART", "ASE", "ATL", "ATW", "AUS", "AVL", "AVP", "AZA", "AZO", "BDL", "BET", "BFF", "BFL", "BGM", "BGR", "BHM", "BIL", "BIS", "BJI", "BKG", "BLI", "BLV", "BMI", "BNA", "BOI", "BOS", "BPT", "BQK", "BQN", "BRD", "BRO", "BRW", "BTM", "BTR", "BTV", "BUF", "BUR", "BWI", "BZN", "CAE", "CAK", "CDC", "CDV", "CEC", "CGI", "CHA", "CHO", "CHS", "CIC", "CID", "CIU", "CKB", "CLD", "CLE", "CLL", "CLT", "CMH", "CMI", "CMX", "CNY", "COD", "COS", "COU", "CPR", "CRP", "CRW", "CSG", "CVG", "CWA", "CYS", "DAB", "DAL", "DAY", "DBQ", "DCA", "DEN", "DFW", "DHN", "DIK", "DLG", "DLH", "DRO", "DRT", "DSM", "DTW", "DVL", "EAR", "EAU", "ECP", "EGE", "EKO", "ELM", "ELP", "ERI", "ESC", "EUG", "EVV", "EWN", "EWR", "EYW", "FAI", "FAR", "FAT", "FAY", "FCA", "FLG", "FLL", "FLO", "FNT", "FOE", "FSD", "FSM", "FWA", "GCC", "GCK", "GEG", "GFK", "GGG", "GJT", "GNV", "GPT", "GRB", "GRI", "GRK", "GRR", "GSO", "GSP", "GST", "GTF", "GTR", "GUC", "GUM", "HDN", "HGR", "HHH", "HIB", "HLN", "HNL", "HOB", "HOU", "HPN", "HRL", "HSV", "HTS", "HVN", "HYA", "HYS", "IAD", "IAG", "IAH", "ICT", "IDA", "IFP", "ILG", "ILM", "IMT", "IND", "INL", "IPL", "ISN", "ISP", "ITH", "ITO", "IYK", "JAC", "JAN", "JAX", "JFK", "JLN", "JMS", "JNU", "KOA", "KTN", "LAN", "LAR", "LAS", "LAW", "LAX", "LBB", "LBE", "LBF", "LBL", "LCH", "LCK", "LEX", "LFT", "LGA", "LGB", "LIH", "LIT", "LMT", "LNK", "LRD", "LSE", "LWB", "LWS", "LYH", "MAF", "MBS", "MCI", "MCO", "MDT", "MDW", "MEI", "MEM", "MFE", "MFR", "MGM", "MHK", "MHT", "MIA", "MKE", "MKG", "MLB", "MLI", "MLU", "MMH", "MOB", "MOD", "MOT", "MQT", "MRY", "MSN", "MSO", "MSP", "MSY", "MTJ", "MVY", "MWH", "MYR", "OAJ", "OAK", "OGD", "OGG", "OGS", "OKC", "OMA", "OME", "ONT", "ORD", "ORF", "ORH", "OTH", "OTZ", "OWB", "OXR", "PAH", "PBG", "PBI", "PDX", "PFN", "PGD", "PGV", "PHF", "PHL", "PHX", "PIA", "PIB", "PIE", "PIH", "PIR", "PIT", "PLN", "PNS", "PPG", "PRC", "PSC", "PSE", "PSG", "PSM", "PSP", "PUB", "PVD", "PVU", "PWM", "RAP", "RDD", "RDM", "RDU", "RFD", "RHI", "RIC", "RKS", "RNO", "ROA", "ROC", "ROW", "RST", "RSW", "SAF", "SAN", "SAT", "SAV", "SBA", "SBN", "SBP", "SCC", "SCE", "SCK", "SDF", "SEA", "SFB", "SFO", "SGF", "SGU", "SHD", "SHV", "SIT", "SJC", "SJT", "SJU", "SLC", "SLN", "SMF", "SMX", "SNA", "SPI", "SPN", "SPS", "SRQ", "STC", "STL", "STS", "STT", "STX", "SUN", "SUX", "SWF", "SWO", "SYR", "TEX", "TLH", "TOL", "TPA", "TRI", "TTN", "TUL", "TUS", "TVC", "TWF", "TXK", "TYR", "TYS", "UIN", "USA", "UST", "UTM", "VEL", "VLD", "VPS", "WRG", "WYS", "XNA", "YAK", "YNG", "YUM" ], "y": [ 39.1409, 38.7657, 36.3865, 35.6665, 40.0742, 41.977, 39.0924, 21.2211, 21.4748, 27.8038, 33.3714, 38.5625, 42.3301, 44.4933, 40.6811, 25.6506, 37.1746, 29.3605, 31.2419, 22.4604, 34.5896, 22.8799, 38.3124, 36.0843, 38.3639, 35.8762, 24.4629, 33.689, 37.8944, 34.115, 38.783, 30.581, 36.967, 36.1392, 38.5178, 36.2853, 34.4315, 34.7979, 33.0259, 30.0174, 34.5245, 39.5257, 33.2584, 32.8826, 25.9619, 34.8677, 43.1659, 41.8726, 33.6289, 36.532, 16.1313, 35.1869, 39.9615, 37.1372, 38.7894, 31.6578, 27.258, 36.0535, 38.4397, 31.2153, 25.5712, 24.0746, 17.729, 24.5723, 37.0631, 33.9601, 38.0526, 20.5248, 35.8113, 32.6035, 30.3032, 26.572, 30.341, 38.5048, 26.936, 35.023, 28.4758, 30.6818, 37.3264, 31.9296, 34.2914, 31.8542, 37.2824, 36.3644, 37.1401, 41.8211, 33.1456, 32.6106, 46.5333, 41.4463, 25.9578, 34.1461, 27.0941, 28.7731, 24.9884, 23.463, 42.6692, 29.8853, 35.4651, 35.7759, 38.0642, 29.8779, 35.1727, 27.992, 32.231, 31.1756, 33.2903, 38.6996, 39.4636, 36.8443, 44.2828, 36.0891, 36.7721, 33.0834, 30.0409, 36.2416, 39.3035, 16.437, 40.6107, 35.8738, 33.6369, 30.69, 43.6462, 36.4086, 44.6146, 31.0817, 35.9479, 36.6149, 25.558, 34.0263, 42.2033, 32.9789, 32.824, 36.3719, 36.413, 38.5555, 40.4225, 37.9999, 43.7342, 38.3859, 35.8613, 35.7754, 41.0932, 37.0066, 37.0412, 37.9405, 21.3444, 34.9912, 42.3112, 43.607, 38.2952, 36.0975, 52.2291, 19.1407, 30.1827, 31.9823, 43.4322, 34.4804, 28.5566, 40.0124, 33.4764, 38.2487, 36.0766, 24.3136, 41.8194, 28.7199, 29.272, 28.8171, 23.6567, 35.9308, 35.2183, 40.4566, 20.0489, 39.782, 28.6199, 35.8494, 21.9095, 29.6287, 30.6742, 35.3734, 38.7509, 50.2164, 33.5638, 38.7145, 39.8402, 37.4048, 22.9836, 33.6907, 30.2454, 29.7459, 42.593, 34.6682, 37.2494, 37.0487, 27.8256, 38.107, 25.916, 35.6886, 21.5225, 34.7036, 19.8404, 34.7056, 30.3306, 37.8026, 37.8534, 19.8916, 29.8799, 43.0516, 37.9595, 27.8724, 31.9599, 36.0671, 30.8326, 38.4265, 38.9604, 33.4282, 34.9836, 39.3489, 35.4159, 31.3019, 38.1918, 26.2706, 34.7812, 32.9884, 38.5108, 27.6655, 41.3119, 33.0717, 37.5433, 30.4319, 30.7123, 33.7439, 41.5398, 38.4723, 38.7799, 36.3056, 39.1175, 19.4058, 33.1544, 23.6621, 25.7954, 35.8856, 35.0851, 28.2045, 35.2933, 40.8853, 42.3675, 13.0775, 35.0144, 44.2178, 29.0615, 31.7742, 45.7425, 44.7895, 37.2612, 35.9621, 25.6708, 34.3217, 19.3986, 39.0565, 47.4619, 21.7703, 34.8801, 28.5201, 25.3355, 27.025, 32.5722, 34.5911, 31.4552, 35.2028, 22.1376, 37.7022, 34.6264, 24.4463, 29.4538, 34.1586, 17.4093, 23.3288, 34.3953, 28, 36.9725, 37.6778, 37.6138, 93.6154, 27.4259, 32.6351, 41.2414, 19.8029, 30.4119, 30.921, 39.4852, 36.9467, 39.1283, 37.6651, 34.9893, 21.4888, 29.3953, 35.9337, 35.4578, 27.8825, 35.9441, 36.4404, 33.5417, 42.4599, 36.967, 40.039, 34.9395, 34.4826, 39.6648, 31.9533, 37.249, 36.9495, 28.7625, 34.209, 27.8231, 30.6034, 36.3984, 28.7564, 36.8404, 28.149, 25.3517, 17.5509, 36.317, 30.0646, 22.7417, 40.2331, 28.4796, 29.7014, 37.3283, 42.0604, 29.1531, 24.9569, 31.0992, 27.3239, 33.27, 33.5995, 62.4477, 39.8869, 36.7009, 27.5266, 33.1663, 26.3966, 41.8585, 46.8985, 38.8638, 24.5882, 42.114, 36.69, 38.1172, 58.375, 41.4161, 31.0751, 33.1468, 42.7647, 19.9083, 38.2523, 34.7803, 36.9229, 33.9164, 41.5209, 37.9763, 36.708, 29.7442, 26.4788, 21.2321, 29.9444, 45.3441, 41.1505, 39.4651, 17.5669, 44.6394, 34.8632, 16.1467, 69.5, 41.7166 ] }, { "name": "% of Weather Delay", "type": "bar", "uid": "fb2918f9-b8d8-4f26-b008-17dc826342e9", "x": [ "ABE", "ABI", "ABQ", "ABR", "ABY", "ACK", "ACT", "ACV", "ACY", "ADK", "ADQ", "AEX", "AGS", "AKN", "ALB", "ALO", "AMA", "ANC", "APN", "ART", "ASE", "ATL", "ATW", "AUS", "AVL", "AVP", "AZA", "AZO", "BDL", "BET", "BFF", "BFL", "BGM", "BGR", "BHM", "BIL", "BIS", "BJI", "BKG", "BLI", "BLV", "BMI", "BNA", "BOI", "BOS", "BPT", "BQK", "BQN", "BRD", "BRO", "BRW", "BTM", "BTR", "BTV", "BUF", "BUR", "BWI", "BZN", "CAE", "CAK", "CDC", "CDV", "CEC", "CGI", "CHA", "CHO", "CHS", "CIC", "CID", "CIU", "CKB", "CLD", "CLE", "CLL", "CLT", "CMH", "CMI", "CMX", "CNY", "COD", "COS", "COU", "CPR", "CRP", "CRW", "CSG", "CVG", "CWA", "CYS", "DAB", "DAL", "DAY", "DBQ", "DCA", "DEN", "DFW", "DHN", "DIK", "DLG", "DLH", "DRO", "DRT", "DSM", "DTW", "DVL", "EAR", "EAU", "ECP", "EGE", "EKO", "ELM", "ELP", "ERI", "ESC", "EUG", "EVV", "EWN", "EWR", "EYW", "FAI", "FAR", "FAT", "FAY", "FCA", "FLG", "FLL", "FLO", "FNT", "FOE", "FSD", "FSM", "FWA", "GCC", "GCK", "GEG", "GFK", "GGG", "GJT", "GNV", "GPT", "GRB", "GRI", "GRK", "GRR", "GSO", "GSP", "GST", "GTF", "GTR", "GUC", "GUM", "HDN", "HGR", "HHH", "HIB", "HLN", "HNL", "HOB", "HOU", "HPN", "HRL", "HSV", "HTS", "HVN", "HYA", "HYS", "IAD", "IAG", "IAH", "ICT", "IDA", "IFP", "ILG", "ILM", "IMT", "IND", "INL", "IPL", "ISN", "ISP", "ITH", "ITO", "IYK", "JAC", "JAN", "JAX", "JFK", "JLN", "JMS", "JNU", "KOA", "KTN", "LAN", "LAR", "LAS", "LAW", "LAX", "LBB", "LBE", "LBF", "LBL", "LCH", "LCK", "LEX", "LFT", "LGA", "LGB", "LIH", "LIT", "LMT", "LNK", "LRD", "LSE", "LWB", "LWS", "LYH", "MAF", "MBS", "MCI", "MCO", "MDT", "MDW", "MEI", "MEM", "MFE", "MFR", "MGM", "MHK", "MHT", "MIA", "MKE", "MKG", "MLB", "MLI", "MLU", "MMH", "MOB", "MOD", "MOT", "MQT", "MRY", "MSN", "MSO", "MSP", "MSY", "MTJ", "MVY", "MWH", "MYR", "OAJ", "OAK", "OGD", "OGG", "OGS", "OKC", "OMA", "OME", "ONT", "ORD", "ORF", "ORH", "OTH", "OTZ", "OWB", "OXR", "PAH", "PBG", "PBI", "PDX", "PFN", "PGD", "PGV", "PHF", "PHL", "PHX", "PIA", "PIB", "PIE", "PIH", "PIR", "PIT", "PLN", "PNS", "PPG", "PRC", "PSC", "PSE", "PSG", "PSM", "PSP", "PUB", "PVD", "PVU", "PWM", "RAP", "RDD", "RDM", "RDU", "RFD", "RHI", "RIC", "RKS", "RNO", "ROA", "ROC", "ROW", "RST", "RSW", "SAF", "SAN", "SAT", "SAV", "SBA", "SBN", "SBP", "SCC", "SCE", "SCK", "SDF", "SEA", "SFB", "SFO", "SGF", "SGU", "SHD", "SHV", "SIT", "SJC", "SJT", "SJU", "SLC", "SLN", "SMF", "SMX", "SNA", "SPI", "SPN", "SPS", "SRQ", "STC", "STL", "STS", "STT", "STX", "SUN", "SUX", "SWF", "SWO", "SYR", "TEX", "TLH", "TOL", "TPA", "TRI", "TTN", "TUL", "TUS", "TVC", "TWF", "TXK", "TYR", "TYS", "UIN", "USA", "UST", "UTM", "VEL", "VLD", "VPS", "WRG", "WYS", "XNA", "YAK", "YNG", "YUM" ], "y": [ 3.445, 11.3552, 2.1461, 4.5316, 3.3438, 11.4092, 6.119, 3.1739, 1.9895, 2.7341, 19.6216, 4.7604, 3.5228, 0, 3.2019, 8.9154, 3.8723, 2.9227, 6.1008, 18.1248, 6.1741, 2.7785, 3.1129, 2.8972, 3.2871, 3.4187, 4.818, 6.8869, 3.5595, 10.7486, 2.1499, 1.5247, 5.8417, 4.5487, 3.8014, 3.9288, 3.7251, 4.9512, 2.8211, 2.4366, 7.1431, 4.3395, 3.2107, 1.8783, 2.9681, 3.4993, 1.9404, 2.7858, 7.8863, 2.9786, 11.1645, 9.6153, 3.4099, 3.5452, 3.478, 1.2173, 3.6025, 3.5808, 3.5937, 2.5266, 2.0587, 4.1858, 2.7179, 1.8735, 3.6608, 4.8304, 3.8165, 0.4535, 5.4128, 6.8426, 4.7864, 1.7279, 3.0653, 6.125, 2.8938, 3.7008, 10.7521, 4.7447, 9.3125, 4.9714, 3.1004, 8.0899, 4.7382, 4.1584, 3.3508, 2.881, 5.208, 5.1072, 7.6963, 5.374, 2.8593, 4.0713, 9.8947, 3.6664, 2.8777, 3.9155, 1.6172, 2.8729, 6.0306, 5.1042, 4.2194, 0.9809, 4.6804, 3.3591, 2.1512, 2.356, 2.1231, 4.3038, 7.2446, 4.2603, 2.4433, 2.5766, 4.445, 7.0491, 1.5883, 5.5339, 2.3173, 2.8, 5.2196, 3.3575, 4.5962, 1.9919, 2.9902, 3.1445, 4.4602, 2.5508, 1.2714, 3.1499, 1.0367, 4.2873, 5.2799, 4.9339, 3.7635, 10.4082, 1.9282, 4.0228, 6.8168, 4.6938, 2.5252, 4.4682, 4.4388, 8.8466, 5.7884, 4.1751, 4.074, 3.7811, 5.46, 3.0831, 1.7784, 6.8588, 0.6065, 4.9154, 9.3488, 7.359, 10.0891, 3.8837, 2.3246, 2.5125, 2.7772, 2.7169, 2.6609, 4.6476, 11.09, 7.7281, 2.3611, 3.8335, 3.3293, 5.8771, 3.121, 3.5313, 2.5274, 1.3879, 0.5905, 3.4152, 5.9316, 2.8754, 4.8064, 0.2563, 3.3778, 3.0949, 6.1782, 1.9835, 1.0468, 5.5896, 4.6085, 3.6071, 2.528, 7.8073, 7.8189, 5.5587, 1.4143, 3.9561, 3.0827, 3.5564, 2.5285, 6.7114, 2.6785, 3.9098, 3.2653, 4.0804, 2.4208, 6.7051, 9.9504, 4.4416, 4.8796, 3.7428, 1.4007, 1.6098, 4.0248, 1.404, 2.6962, 5.4491, 5.8437, 4.8251, 3.5374, 5.49, 3.498, 3.7136, 2.8579, 2.5602, 4.7303, 3.8076, 1.4004, 3.7973, 4.5311, 2.072, 3.7985, 9.226, 2.7445, 3.6467, 2.363, 3.4728, 4.4596, 4.0707, 3.2404, 4.9599, 4.1026, 0.6601, 3.5748, 8.1186, 2.303, 4.3067, 2.8775, 3.6776, 3.1103, 4.9098, 4.0574, 4.3502, 3.2427, 2.6617, 0.86, 10.4839, 1.7619, 14.0526, 3.4335, 3.1701, 10.7925, 1.3342, 2.7443, 3.7964, 4.5518, 1.7514, 7.958, 0, 0.4701, 1.8604, 2.6849, 2.725, 2.0928, 3.0427, 3.7844, 7.4586, 1.9162, 3.7282, 2.131, 4.4787, 0.5912, 5.6036, 2.798, 0, 3.3321, 8.8183, 4.989, 3.1077, 0.8519, 2.6445, 2.0678, 7.74, 7.6623, 2.1216, 3.8685, 3.1172, 6.3677, 3.2238, 4.4088, 0.6264, 1.608, 3.5264, 5.6115, 12.9009, 3.3238, 3.9407, 1.7024, 3.1167, 4.0553, 7.9569, 6.0003, 3.0154, 4.8718, 2.4512, 3.1891, 4.3441, 1.4624, 3.0621, 2.0125, 13.5948, 3.4264, 3.0721, 3.0734, 2.6305, 3.8218, 2.6181, 6.4663, 2.048, 5.3634, 3.2003, 3.4016, 1.5706, 6.912, 3.4692, 2.7474, 2.8524, 1.6635, 1.01, 2.4251, 3.9348, 6.2739, 7.3311, 3.3264, 2.4238, 2.8248, 1.8206, 4.1378, 4.878, 3.1053, 9.703, 3.1855, 8.4639, 4.2647, 8.8438, 4.788, 8.1048, 3.0258, 3.3056, 1.1023, 3.4706, 2.4169, 4.9649, 3.452, 6.8867, 6.819, 3.7961, 3.213, 9.3063, 0.9793, 5.5556, 1.088, 2.6635, 4.5688, 10.8489, 1.5046, 5.3679, 3.8578, 0, 1.5233 ] }, { "name": "% of National Air System Delay", "type": "bar", "uid": "ff6e8724-e3bf-41e1-85bf-f9fa9ae62ad4", "x": [ "ABE", "ABI", "ABQ", "ABR", "ABY", "ACK", "ACT", "ACV", "ACY", "ADK", "ADQ", "AEX", "AGS", "AKN", "ALB", "ALO", "AMA", "ANC", "APN", "ART", "ASE", "ATL", "ATW", "AUS", "AVL", "AVP", "AZA", "AZO", "BDL", "BET", "BFF", "BFL", "BGM", "BGR", "BHM", "BIL", "BIS", "BJI", "BKG", "BLI", "BLV", "BMI", "BNA", "BOI", "BOS", "BPT", "BQK", "BQN", "BRD", "BRO", "BRW", "BTM", "BTR", "BTV", "BUF", "BUR", "BWI", "BZN", "CAE", "CAK", "CDC", "CDV", "CEC", "CGI", "CHA", "CHO", "CHS", "CIC", "CID", "CIU", "CKB", "CLD", "CLE", "CLL", "CLT", "CMH", "CMI", "CMX", "CNY", "COD", "COS", "COU", "CPR", "CRP", "CRW", "CSG", "CVG", "CWA", "CYS", "DAB", "DAL", "DAY", "DBQ", "DCA", "DEN", "DFW", "DHN", "DIK", "DLG", "DLH", "DRO", "DRT", "DSM", "DTW", "DVL", "EAR", "EAU", "ECP", "EGE", "EKO", "ELM", "ELP", "ERI", "ESC", "EUG", "EVV", "EWN", "EWR", "EYW", "FAI", "FAR", "FAT", "FAY", "FCA", "FLG", "FLL", "FLO", "FNT", "FOE", "FSD", "FSM", "FWA", "GCC", "GCK", "GEG", "GFK", "GGG", "GJT", "GNV", "GPT", "GRB", "GRI", "GRK", "GRR", "GSO", "GSP", "GST", "GTF", "GTR", "GUC", "GUM", "HDN", "HGR", "HHH", "HIB", "HLN", "HNL", "HOB", "HOU", "HPN", "HRL", "HSV", "HTS", "HVN", "HYA", "HYS", "IAD", "IAG", "IAH", "ICT", "IDA", "IFP", "ILG", "ILM", "IMT", "IND", "INL", "IPL", "ISN", "ISP", "ITH", "ITO", "IYK", "JAC", "JAN", "JAX", "JFK", "JLN", "JMS", "JNU", "KOA", "KTN", "LAN", "LAR", "LAS", "LAW", "LAX", "LBB", "LBE", "LBF", "LBL", "LCH", "LCK", "LEX", "LFT", "LGA", "LGB", "LIH", "LIT", "LMT", "LNK", "LRD", "LSE", "LWB", "LWS", "LYH", "MAF", "MBS", "MCI", "MCO", "MDT", "MDW", "MEI", "MEM", "MFE", "MFR", "MGM", "MHK", "MHT", "MIA", "MKE", "MKG", "MLB", "MLI", "MLU", "MMH", "MOB", "MOD", "MOT", "MQT", "MRY", "MSN", "MSO", "MSP", "MSY", "MTJ", "MVY", "MWH", "MYR", "OAJ", "OAK", "OGD", "OGG", "OGS", "OKC", "OMA", "OME", "ONT", "ORD", "ORF", "ORH", "OTH", "OTZ", "OWB", "OXR", "PAH", "PBG", "PBI", "PDX", "PFN", "PGD", "PGV", "PHF", "PHL", "PHX", "PIA", "PIB", "PIE", "PIH", "PIR", "PIT", "PLN", "PNS", "PPG", "PRC", "PSC", "PSE", "PSG", "PSM", "PSP", "PUB", "PVD", "PVU", "PWM", "RAP", "RDD", "RDM", "RDU", "RFD", "RHI", "RIC", "RKS", "RNO", "ROA", "ROC", "ROW", "RST", "RSW", "SAF", "SAN", "SAT", "SAV", "SBA", "SBN", "SBP", "SCC", "SCE", "SCK", "SDF", "SEA", "SFB", "SFO", "SGF", "SGU", "SHD", "SHV", "SIT", "SJC", "SJT", "SJU", "SLC", "SLN", "SMF", "SMX", "SNA", "SPI", "SPN", "SPS", "SRQ", "STC", "STL", "STS", "STT", "STX", "SUN", "SUX", "SWF", "SWO", "SYR", "TEX", "TLH", "TOL", "TPA", "TRI", "TTN", "TUL", "TUS", "TVC", "TWF", "TXK", "TYR", "TYS", "UIN", "USA", "UST", "UTM", "VEL", "VLD", "VPS", "WRG", "WYS", "XNA", "YAK", "YNG", "YUM" ], "y": [ 24.4818, 16.8096, 16.7205, 28.3813, 17.365, 23.2384, 17.8209, 14.5378, 48.9663, 42.9572, 28.4236, 21.7265, 17.9615, 22.0267, 18.8702, 31.2078, 18.2024, 34.1343, 21.1626, 30.5528, 25.4465, 37.5837, 24.9036, 22.2588, 22.1326, 23.932, 23.4629, 28.3122, 21.5726, 28.0091, 14.4233, 17.9055, 30.0768, 27.8131, 19.5316, 26.3748, 26.8242, 31.735, 25.4364, 35.2796, 28.3056, 21.9567, 21.261, 17.0928, 37.8666, 22.6224, 17.5886, 24.9276, 23.7584, 25.4463, 22.1225, 39.3248, 22.9875, 25.5645, 20.0357, 13.0139, 25.9793, 28.9481, 22.2428, 21.1638, 53.0539, 21.5807, 13.1218, 17.1325, 22.7376, 23.0838, 25.1158, 10.1962, 27.1543, 30.2648, 24.4773, 16.4467, 24.4807, 20.2067, 37.2681, 22.6688, 27.84, 22.2403, 27.2153, 27.4509, 25.2586, 25.5452, 23.2986, 20.0243, 21.6128, 19.492, 26.8405, 28.7693, 20.8667, 21.9913, 18.2508, 24.2434, 33.2813, 35.2585, 31.9638, 31.384, 16.4145, 37.5813, 20.2896, 24.4331, 25.5438, 19.4923, 25.7843, 30.357, 19.3391, 28.772, 21.3621, 17.2257, 29.7053, 32.0533, 22.9202, 16.2692, 28.4794, 26.8873, 19.6306, 24.0756, 18.7401, 56.4427, 24.6569, 31.1585, 26.3857, 18.1243, 18.8188, 28.8209, 20.2321, 33.9169, 22.4066, 22.2148, 26.119, 27.1116, 17.79, 24.8289, 30.4286, 15.2343, 19.4151, 26.5812, 20.3036, 26.5968, 18.9219, 23.8455, 24.8341, 20.5426, 21.1659, 25.9339, 24.9957, 21.6383, 25.5049, 26.1855, 18.428, 24.0974, 30.4544, 28.0616, 14.9419, 26.3196, 35.6184, 27.0066, 22.5896, 36.4091, 22.1126, 24.3329, 13.7785, 23.919, 20.5491, 21.8223, 23.7083, 23.6056, 28.5418, 40.0286, 38.4837, 24.6649, 26.3741, 38.636, 46.303, 21.0658, 20.4775, 23.0115, 23.8991, 11.9236, 31.3516, 12.3884, 26.9624, 11.3389, 12.1705, 23.7058, 22.8612, 23.9386, 45.5946, 15.8352, 27.7927, 28.0948, 27.1822, 29.2885, 24.7749, 23.5254, 26.7659, 17.1524, 36.3302, 18.1723, 42.6678, 19.1597, 26.831, 24.8806, 20.6116, 23.6786, 24.0922, 52.0475, 21.7791, 25.7182, 21.4559, 14.3898, 26.5063, 25.77, 34.1317, 20.3243, 42.0582, 21.9262, 19.2948, 23.4323, 20.7888, 31.0538, 25.1312, 24.1526, 20.6373, 29.117, 22.7518, 20.1977, 17.8174, 23.9983, 16.6097, 34.7053, 25.2611, 21.2185, 21.4091, 24.0699, 19.6319, 18.8549, 23.3562, 7.6885, 29.2224, 26.8566, 17.6114, 25.4844, 30.1161, 33.03, 23.6763, 25.9103, 20.1164, 2.5128, 33.23, 18.7962, 15.1485, 32.1613, 27.5261, 34.8421, 20.6495, 22.9872, 22.2205, 12.9115, 41.5868, 20.9851, 19.9477, 16.7527, 27.8984, 26.1862, 21.4377, 21.9346, 40.6846, 32.3912, 24.4084, 26.4976, 31.0957, 15.836, 22.0949, 44.8355, 29.2075, 23.7593, 12.6029, 25.0325, 39.4402, 72, 21.8894, 25.4112, 24.0392, 1.3538, 19.6852, 23.4342, 21.823, 21.526, 23.2412, 23.5911, 23.9623, 19.5493, 20.53, 22.7291, 27.1576, 11.2191, 20.0724, 23.9767, 28.0438, 27.7875, 24.015, 30.7384, 15.3939, 21.3721, 21.643, 21.021, 27.209, 33.2413, 24.9786, 23.4169, 19.991, 26.4605, 18.2094, 23.2188, 17.7504, 23.9474, 27.1179, 26.0111, 22.4232, 36.4493, 22.1353, 50.0368, 23.5179, 38.8783, 14.7259, 20.4645, 22.4477, 17.6468, 20.4289, 28.6547, 26.4886, 24.814, 15.2443, 13.6867, 21.7637, 21.8037, 20.3492, 17.6666, 31.1278, 20.3907, 20.474, 22.469, 34.2835, 21.7058, 32.2373, 33.3061, 22.5832, 19.5181, 25.1173, 23.75, 22.2458, 25.6717, 27.5453, 16.8359, 35.6651, 19.9762, 19.8119, 26.1862, 37.3281, 18.5304, 19.3331, 24.1851, 30.3747, 24.4478, 44.4784, 53.7222, 29.6609, 17.8575, 22.7644, 20.0677, 38.5642, 27.1584, 21.7535, 30.5, 16.5668 ] }, { "name": "% of Security Delay", "type": "bar", "uid": "85b528e8-da0b-4331-8ceb-67f4523d3dbc", "x": [ "ABE", "ABI", "ABQ", "ABR", "ABY", "ACK", "ACT", "ACV", "ACY", "ADK", "ADQ", "AEX", "AGS", "AKN", "ALB", "ALO", "AMA", "ANC", "APN", "ART", "ASE", "ATL", "ATW", "AUS", "AVL", "AVP", "AZA", "AZO", "BDL", "BET", "BFF", "BFL", "BGM", "BGR", "BHM", "BIL", "BIS", "BJI", "BKG", "BLI", "BLV", "BMI", "BNA", "BOI", "BOS", "BPT", "BQK", "BQN", "BRD", "BRO", "BRW", "BTM", "BTR", "BTV", "BUF", "BUR", "BWI", "BZN", "CAE", "CAK", "CDC", "CDV", "CEC", "CGI", "CHA", "CHO", "CHS", "CIC", "CID", "CIU", "CKB", "CLD", "CLE", "CLL", "CLT", "CMH", "CMI", "CMX", "CNY", "COD", "COS", "COU", "CPR", "CRP", "CRW", "CSG", "CVG", "CWA", "CYS", "DAB", "DAL", "DAY", "DBQ", "DCA", "DEN", "DFW", "DHN", "DIK", "DLG", "DLH", "DRO", "DRT", "DSM", "DTW", "DVL", "EAR", "EAU", "ECP", "EGE", "EKO", "ELM", "ELP", "ERI", "ESC", "EUG", "EVV", "EWN", "EWR", "EYW", "FAI", "FAR", "FAT", "FAY", "FCA", "FLG", "FLL", "FLO", "FNT", "FOE", "FSD", "FSM", "FWA", "GCC", "GCK", "GEG", "GFK", "GGG", "GJT", "GNV", "GPT", "GRB", "GRI", "GRK", "GRR", "GSO", "GSP", "GST", "GTF", "GTR", "GUC", "GUM", "HDN", "HGR", "HHH", "HIB", "HLN", "HNL", "HOB", "HOU", "HPN", "HRL", "HSV", "HTS", "HVN", "HYA", "HYS", "IAD", "IAG", "IAH", "ICT", "IDA", "IFP", "ILG", "ILM", "IMT", "IND", "INL", "IPL", "ISN", "ISP", "ITH", "ITO", "IYK", "JAC", "JAN", "JAX", "JFK", "JLN", "JMS", "JNU", "KOA", "KTN", "LAN", "LAR", "LAS", "LAW", "LAX", "LBB", "LBE", "LBF", "LBL", "LCH", "LCK", "LEX", "LFT", "LGA", "LGB", "LIH", "LIT", "LMT", "LNK", "LRD", "LSE", "LWB", "LWS", "LYH", "MAF", "MBS", "MCI", "MCO", "MDT", "MDW", "MEI", "MEM", "MFE", "MFR", "MGM", "MHK", "MHT", "MIA", "MKE", "MKG", "MLB", "MLI", "MLU", "MMH", "MOB", "MOD", "MOT", "MQT", "MRY", "MSN", "MSO", "MSP", "MSY", "MTJ", "MVY", "MWH", "MYR", "OAJ", "OAK", "OGD", "OGG", "OGS", "OKC", "OMA", "OME", "ONT", "ORD", "ORF", "ORH", "OTH", "OTZ", "OWB", "OXR", "PAH", "PBG", "PBI", "PDX", "PFN", "PGD", "PGV", "PHF", "PHL", "PHX", "PIA", "PIB", "PIE", "PIH", "PIR", "PIT", "PLN", "PNS", "PPG", "PRC", "PSC", "PSE", "PSG", "PSM", "PSP", "PUB", "PVD", "PVU", "PWM", "RAP", "RDD", "RDM", "RDU", "RFD", "RHI", "RIC", "RKS", "RNO", "ROA", "ROC", "ROW", "RST", "RSW", "SAF", "SAN", "SAT", "SAV", "SBA", "SBN", "SBP", "SCC", "SCE", "SCK", "SDF", "SEA", "SFB", "SFO", "SGF", "SGU", "SHD", "SHV", "SIT", "SJC", "SJT", "SJU", "SLC", "SLN", "SMF", "SMX", "SNA", "SPI", "SPN", "SPS", "SRQ", "STC", "STL", "STS", "STT", "STX", "SUN", "SUX", "SWF", "SWO", "SYR", "TEX", "TLH", "TOL", "TPA", "TRI", "TTN", "TUL", "TUS", "TVC", "TWF", "TXK", "TYR", "TYS", "UIN", "USA", "UST", "UTM", "VEL", "VLD", "VPS", "WRG", "WYS", "XNA", "YAK", "YNG", "YUM" ], "y": [ 0.0904, 0.2497, 0.2723, 0, 0.1066, 0.145, 0.1174, 0.0145, 0.3208, 0.6937, 0.1587, 0.1463, 0.0594, 0, 0.2014, 0, 0.2362, 1.6537, 0.1972, 0, 0.1784, 0.0912, 0.0666, 0.2412, 0.1299, 0.159, 0.9877, 0.0361, 0.195, 0.0874, 0, 0.1755, 0.1078, 0.1412, 0.2027, 0.0541, 0.0848, 0.1859, 0, 0.1354, 0.4024, 0.0558, 0.2515, 0.1989, 0.1379, 0.3353, 0.0084, 0.4608, 0, 0.1496, 1.0581, 0.0711, 0.1013, 0.0734, 0.216, 0.2498, 0.2835, 0.0734, 0.0972, 0.088, 0.1661, 0.0957, 0.1059, 0, 0.0673, 0.0708, 0.1907, 0, 0.0911, 0.3473, 0, 0.1349, 0.122, 0.1107, 0.2183, 0.1637, 0, 0.0925, 0, 0.0729, 0.1736, 0.0522, 0.1215, 0.1123, 0.0944, 0.0419, 0.1161, 0.169, 0, 0.1444, 0.251, 0.1111, 0, 0.1706, 0.1773, 0.1499, 0.1184, 0, 0, 0.0835, 0.3102, 0, 0.1337, 0.1556, 0.2193, 0, 0, 0.1468, 0.0694, 0.09, 0.129, 0.2535, 0.0043, 0, 0.0701, 0.0819, 0.067, 0.0936, 0.0871, 0.523, 0.0704, 0.1432, 0.1326, 0.1331, 0.9912, 0.318, 0, 0.0688, 0, 0.0745, 0.1149, 0.1217, 0.0881, 0.4024, 0.1874, 0.2249, 0.3463, 0.2398, 0.0878, 0.1318, 0.098, 0, 0.157, 0.1281, 0.0993, 0.1068, 0, 0.0823, 0.0282, 0.0627, 0, 0.1469, 0, 0.4954, 0, 0.0772, 0.2308, 0, 0.3001, 0.1687, 0.0844, 0.131, 0.3584, 0.4439, 0, 0.1789, 0.1082, 0.9914, 0.1564, 0.1173, 0.0798, 0, 0, 0.0817, 0, 0.1503, 0.211, 0, 0.0502, 0.2606, 0.0649, 0.2691, 0, 0.1073, 0.213, 0.2466, 0.1973, 0.1126, 0.2336, 1.138, 0.1535, 0.3146, 0.1153, 0.1043, 0.2719, 0.0581, 0.2256, 0.1959, 0.5161, 0, 0, 0.1248, 0.562, 0.1597, 0.1258, 0.0977, 0.1878, 0.2744, 0.1987, 0.104, 0.1197, 0.2434, 0.0889, 0, 0.0692, 0, 0.2476, 0.1253, 0.239, 0.2727, 0.1191, 0.3708, 0.0176, 0.1809, 0.2481, 0.0343, 0.0904, 0.0854, 0.2092, 0.2213, 0.1568, 0, 0.0277, 0.157, 0.0816, 0, 0.1198, 0.0449, 0.0545, 0, 0.2707, 0.0638, 0.0676, 0.1634, 0.2303, 0.1485, 0.2379, 0, 0.3391, 0.14, 0.2741, 0, 0.2341, 0, 0.1833, 0.1779, 1.5496, 0.2874, 0.0987, 0.145, 0.2469, 0.0185, 0.8968, 0, 0, 0.0671, 0.8389, 0.2419, 0.2843, 0.0583, 0.349, 0.0232, 0.0328, 0.1856, 0.3084, 0.0503, 0, 0.3076, 0.0479, 0, 0.191, 0.6939, 0.1462, 0.8231, 0, 0.0967, 0.3382, 0.6081, 1.5765, 0.2165, 0.3068, 0.2732, 1.0872, 0.1647, 0.0349, 0.0631, 0.1027, 0.1925, 0.8774, 0, 0.1462, 0.1016, 0.2194, 0.0799, 0.1246, 0.264, 0.0248, 0.1852, 0.128, 0.2267, 0.2752, 0.0845, 0.1781, 0.0563, 0.1622, 0, 0.1013, 0.3586, 0.1606, 0.3196, 0.5713, 0.1192, 0.1418, 0.0992, 0, 0.0472, 0.1271, 0.2135, 0.2637, 0.4048, 0.2015, 0, 0.2151, 0.1499, 0.1909, 0.2322, 0, 0.3294, 0.1495, 0, 0.2519, 0.2425, 0.4358, 0.6204, 0.078, 0, 0.2685, 0, 0.1394, 0, 0.1229, 0, 0.2543, 0.0685, 0, 0.1362, 0.2596, 0.0908, 0.117, 0.0508, 0.0928, 0.0583, 0, 0, 0, 0, 0, 0.0526, 0.1067, 0.3102, 0.4717, 0.1322, 1.4608, 0, 0.5345 ] }, { "name": "% of Late Aircraft Delay", "type": "bar", "uid": "16726630-5216-4562-8597-53e276d0a561", "x": [ "ABE", "ABI", "ABQ", "ABR", "ABY", "ACK", "ACT", "ACV", "ACY", "ADK", "ADQ", "AEX", "AGS", "AKN", "ALB", "ALO", "AMA", "ANC", "APN", "ART", "ASE", "ATL", "ATW", "AUS", "AVL", "AVP", "AZA", "AZO", "BDL", "BET", "BFF", "BFL", "BGM", "BGR", "BHM", "BIL", "BIS", "BJI", "BKG", "BLI", "BLV", "BMI", "BNA", "BOI", "BOS", "BPT", "BQK", "BQN", "BRD", "BRO", "BRW", "BTM", "BTR", "BTV", "BUF", "BUR", "BWI", "BZN", "CAE", "CAK", "CDC", "CDV", "CEC", "CGI", "CHA", "CHO", "CHS", "CIC", "CID", "CIU", "CKB", "CLD", "CLE", "CLL", "CLT", "CMH", "CMI", "CMX", "CNY", "COD", "COS", "COU", "CPR", "CRP", "CRW", "CSG", "CVG", "CWA", "CYS", "DAB", "DAL", "DAY", "DBQ", "DCA", "DEN", "DFW", "DHN", "DIK", "DLG", "DLH", "DRO", "DRT", "DSM", "DTW", "DVL", "EAR", "EAU", "ECP", "EGE", "EKO", "ELM", "ELP", "ERI", "ESC", "EUG", "EVV", "EWN", "EWR", "EYW", "FAI", "FAR", "FAT", "FAY", "FCA", "FLG", "FLL", "FLO", "FNT", "FOE", "FSD", "FSM", "FWA", "GCC", "GCK", "GEG", "GFK", "GGG", "GJT", "GNV", "GPT", "GRB", "GRI", "GRK", "GRR", "GSO", "GSP", "GST", "GTF", "GTR", "GUC", "GUM", "HDN", "HGR", "HHH", "HIB", "HLN", "HNL", "HOB", "HOU", "HPN", "HRL", "HSV", "HTS", "HVN", "HYA", "HYS", "IAD", "IAG", "IAH", "ICT", "IDA", "IFP", "ILG", "ILM", "IMT", "IND", "INL", "IPL", "ISN", "ISP", "ITH", "ITO", "IYK", "JAC", "JAN", "JAX", "JFK", "JLN", "JMS", "JNU", "KOA", "KTN", "LAN", "LAR", "LAS", "LAW", "LAX", "LBB", "LBE", "LBF", "LBL", "LCH", "LCK", "LEX", "LFT", "LGA", "LGB", "LIH", "LIT", "LMT", "LNK", "LRD", "LSE", "LWB", "LWS", "LYH", "MAF", "MBS", "MCI", "MCO", "MDT", "MDW", "MEI", "MEM", "MFE", "MFR", "MGM", "MHK", "MHT", "MIA", "MKE", "MKG", "MLB", "MLI", "MLU", "MMH", "MOB", "MOD", "MOT", "MQT", "MRY", "MSN", "MSO", "MSP", "MSY", "MTJ", "MVY", "MWH", "MYR", "OAJ", "OAK", "OGD", "OGG", "OGS", "OKC", "OMA", "OME", "ONT", "ORD", "ORF", "ORH", "OTH", "OTZ", "OWB", "OXR", "PAH", "PBG", "PBI", "PDX", "PFN", "PGD", "PGV", "PHF", "PHL", "PHX", "PIA", "PIB", "PIE", "PIH", "PIR", "PIT", "PLN", "PNS", "PPG", "PRC", "PSC", "PSE", "PSG", "PSM", "PSP", "PUB", "PVD", "PVU", "PWM", "RAP", "RDD", "RDM", "RDU", "RFD", "RHI", "RIC", "RKS", "RNO", "ROA", "ROC", "ROW", "RST", "RSW", "SAF", "SAN", "SAT", "SAV", "SBA", "SBN", "SBP", "SCC", "SCE", "SCK", "SDF", "SEA", "SFB", "SFO", "SGF", "SGU", "SHD", "SHV", "SIT", "SJC", "SJT", "SJU", "SLC", "SLN", "SMF", "SMX", "SNA", "SPI", "SPN", "SPS", "SRQ", "STC", "STL", "STS", "STT", "STX", "SUN", "SUX", "SWF", "SWO", "SYR", "TEX", "TLH", "TOL", "TPA", "TRI", "TTN", "TUL", "TUS", "TVC", "TWF", "TXK", "TYR", "TYS", "UIN", "USA", "UST", "UTM", "VEL", "VLD", "VPS", "WRG", "WYS", "XNA", "YAK", "YNG", "YUM" ], "y": [ 32.842, 32.8198, 44.4745, 31.4206, 39.1105, 23.2303, 36.8503, 61.0527, 27.2487, 25.8111, 18.4247, 34.8043, 36.1262, 33.48, 37.0455, 34.2262, 40.5145, 31.9287, 41.2975, 28.8621, 33.6114, 36.6667, 33.6046, 38.5185, 36.0865, 36.614, 46.2684, 31.0758, 36.7786, 27.0399, 44.6439, 49.8132, 27.0068, 31.3578, 37.9466, 33.3571, 34.9343, 28.3301, 38.7166, 32.1309, 29.6243, 34.1223, 42.0185, 47.9475, 33.0656, 38.6753, 37.2969, 29.9532, 34.7265, 34.8936, 49.5236, 15.8019, 33.5398, 33.6797, 37.481, 53.8611, 42.8768, 31.3441, 35.6266, 45.0063, 19.1501, 50.0632, 66.3255, 56.4217, 36.4713, 38.0549, 32.8244, 68.8255, 31.5305, 29.9418, 40.4332, 55.1186, 41.9909, 35.0528, 32.6838, 38.4437, 32.9321, 42.2407, 26.1458, 35.5752, 37.176, 34.4586, 34.5593, 39.3405, 37.8019, 35.7641, 34.6897, 33.344, 24.9037, 31.044, 52.6811, 37.428, 29.7299, 32.1315, 39.9928, 41.0877, 39.1807, 29.6606, 38.2148, 34.6034, 31.8623, 49.649, 34.2288, 38.1362, 46.0594, 37.6963, 43.2245, 39.624, 23.5171, 26.7521, 30.2247, 44.8117, 30.2992, 32.9803, 48.6702, 34.067, 39.5721, 24.2266, 29.4258, 29.0873, 35.3109, 49.0505, 34.4122, 31.493, 29.702, 32.1325, 40.3741, 37.9516, 47.2863, 34.5004, 34.6119, 37.1365, 32.8959, 37.5832, 42.0562, 30.6156, 32.1109, 30.4698, 34.731, 33.1686, 34.7678, 34.8354, 31.7956, 32.7563, 33.7898, 36.5334, 47.6907, 35.658, 37.4542, 25.3742, 30.6438, 30.7786, 23.4801, 46.6853, 24.1098, 37.0502, 31.4229, 26.5979, 46.2536, 32.769, 49.9998, 33.0539, 31.9259, 45.692, 32.1111, 43.6621, 38.7488, 24.2857, 34.5823, 35.7558, 35.8004, 19.5195, 33.0576, 35.6554, 44.971, 38.1133, 49.174, 58.1914, 34.5462, 48.8828, 28.0435, 36.1922, 53.2189, 31.8828, 32.4771, 34.803, 28.6966, 42.5542, 33.9093, 35.4626, 28.657, 31.7726, 34.7777, 35.7651, 42.6081, 37.9711, 34.8497, 42.0334, 32.0283, 42.0564, 50.9078, 33.5839, 38.5455, 33.9175, 33.049, 24.2203, 46.7525, 29.346, 36.3611, 56.2297, 38.718, 32.4704, 29.103, 36.424, 15.3748, 39.1557, 41.976, 33.3799, 40.6984, 34.8115, 31.8276, 45.3985, 43.1635, 33.9164, 33.9581, 50.0306, 36.9818, 33.6186, 42.8932, 30.9948, 41.5067, 41.5648, 32.5638, 33.2301, 38.2662, 39.8796, 33.3039, 72.2009, 33.9939, 41.3627, 54.0196, 34.2596, 31.8538, 34.9244, 37.6898, 28.1461, 33.2208, 80.0594, 28.1738, 34.1844, 54.6559, 25.5806, 24.7353, 6.3158, 38.4725, 37.7027, 39.7666, 51.1452, 36.1716, 36.017, 27.7918, 59.707, 28.3667, 45.2937, 52.7566, 49.1128, 23.2195, 30.0507, 41.7593, 35.1986, 42.6333, 38.98, 41.3297, 26.8045, 38.8994, 37.5531, 69.3966, 45.7275, 23.3186, 0, 37.615, 27.3988, 33.2118, 1.1, 52.037, 41.1894, 34.5296, 50.3231, 37.108, 43.1499, 32.3772, 40.1136, 32.8868, 36.2173, 33.4094, 66.6026, 48.8216, 36.3708, 30.0095, 31.4291, 36.5709, 28.7789, 49.1426, 32.9714, 37.2101, 30.7191, 31.8264, 29.0755, 30.3568, 41.9518, 39.2957, 32.1614, 51.3876, 39.4539, 52.2518, 31.8543, 32.9561, 41.8018, 37.5024, 32.4516, 48.1199, 29.6751, 33.557, 28.9099, 57.1689, 36.055, 45.544, 50.8677, 35.0671, 25.411, 41.4095, 47.3767, 51.7779, 57.8295, 42.3504, 40.4298, 10.9293, 34.786, 28.6954, 49.6589, 43.2829, 49.0713, 19.2845, 25.8973, 25.7156, 32.4027, 31.8488, 35.3279, 32.3614, 9.0312, 31.4272, 35.1484, 36.0278, 37.0254, 43.3244, 38.1647, 42.7313, 31.8352, 25.1865, 33.0111, 35.7789, 35.2524, 36.6681, 39.7671, 33.3102, 10.7778, 23.9071, 38.2759, 33.095, 51.2064, 14.8201, 32.4784, 56.7812, 0, 39.6588 ] } ], "layout": { "barmode": "stack", "xaxis": { "title": { "text": "Airport" } } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig = go.Figure()\n", "fig.add_trace(go.Bar(x=airports, y=carrier_delay, name='% of Carrier Delay'))\n", "fig.add_trace(go.Bar(x=airports, y=weather_delay, name='% of Weather Delay'))\n", "fig.add_trace(go.Bar(x=airports, y=nas_delay, name='% of National Air System Delay'))\n", "fig.add_trace(go.Bar(x=airports, y=security_delay, name='% of Security Delay'))\n", "fig.add_trace(go.Bar(x=airports, y=lateaircraft_delay, name='% of Late Aircraft Delay'))\n", "\n", "fig.layout.update(barmode='stack', xaxis=dict(title = 'Airport'))\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The above plot is very bad. \n", "\n", "### Relationship Between Seasons and Flight Delays? \n", "\n", "Let's check if the flights are late during any particular season or not. " ] }, { "cell_type": "code", "execution_count": 167, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
yearmonthcarriercarrier_nameairportairport_namearr_flightsarr_del15carrier_ctweather_ct...security_ctlate_aircraft_ctarr_cancelledarr_divertedarr_delaycarrier_delayweather_delaynas_delaysecurity_delaylate_aircraft_delay
0200911ASAlaska Airlines Inc.BRWBarrow, AK: Wiley Post/Will Rogers Memorial65.014.03.611.06...0.06.190.01.0920.0592.034.078.00.0216.0
1200911ASAlaska Airlines Inc.BURBurbank, CA: Bob Hope85.05.01.000.00...0.00.980.00.0134.025.00.070.00.039.0
2200911ASAlaska Airlines Inc.CDVCordova, AK: Merle K Mudhole Smith58.08.02.041.00...0.02.964.02.0586.0174.037.062.00.0313.0
3200911ASAlaska Airlines Inc.DCAWashington, DC: Ronald Reagan Washington National88.011.01.990.00...0.00.000.00.0266.065.00.0201.00.00.0
4200911ASAlaska Airlines Inc.DENDenver, CO: Denver International123.05.03.470.00...0.00.000.00.081.057.00.024.00.00.0
5200911ASAlaska Airlines Inc.DFWDallas/Fort Worth, TX: Dallas/Fort Worth Inter...66.06.01.280.69...0.00.000.00.0176.064.011.0101.00.00.0
6200911ASAlaska Airlines Inc.EWRNewark, NJ: Newark Liberty International59.010.00.240.00...0.00.560.00.0553.08.00.0526.00.019.0
7200911ASAlaska Airlines Inc.FAIFairbanks, AK: Fairbanks International299.041.018.351.82...0.08.702.00.01910.0707.0114.0386.00.0703.0
8200911ASAlaska Airlines Inc.GEGSpokane, WA: Spokane International86.00.00.000.00...0.00.001.00.00.00.00.00.00.00.0
9200911ASAlaska Airlines Inc.HNLHonolulu, HI: Daniel K Inouye International85.018.01.341.46...0.00.000.00.0547.085.089.0373.00.00.0
\n", "

10 rows × 21 columns

\n", "
" ], "text/plain": [ " year month carrier carrier_name airport \\\n", "0 2009 11 AS Alaska Airlines Inc. BRW \n", "1 2009 11 AS Alaska Airlines Inc. BUR \n", "2 2009 11 AS Alaska Airlines Inc. CDV \n", "3 2009 11 AS Alaska Airlines Inc. DCA \n", "4 2009 11 AS Alaska Airlines Inc. DEN \n", "5 2009 11 AS Alaska Airlines Inc. DFW \n", "6 2009 11 AS Alaska Airlines Inc. EWR \n", "7 2009 11 AS Alaska Airlines Inc. FAI \n", "8 2009 11 AS Alaska Airlines Inc. GEG \n", "9 2009 11 AS Alaska Airlines Inc. HNL \n", "\n", " airport_name arr_flights arr_del15 \\\n", "0 Barrow, AK: Wiley Post/Will Rogers Memorial 65.0 14.0 \n", "1 Burbank, CA: Bob Hope 85.0 5.0 \n", "2 Cordova, AK: Merle K Mudhole Smith 58.0 8.0 \n", "3 Washington, DC: Ronald Reagan Washington National 88.0 11.0 \n", "4 Denver, CO: Denver International 123.0 5.0 \n", "5 Dallas/Fort Worth, TX: Dallas/Fort Worth Inter... 66.0 6.0 \n", "6 Newark, NJ: Newark Liberty International 59.0 10.0 \n", "7 Fairbanks, AK: Fairbanks International 299.0 41.0 \n", "8 Spokane, WA: Spokane International 86.0 0.0 \n", "9 Honolulu, HI: Daniel K Inouye International 85.0 18.0 \n", "\n", " carrier_ct weather_ct ... security_ct late_aircraft_ct arr_cancelled \\\n", "0 3.61 1.06 ... 0.0 6.19 0.0 \n", "1 1.00 0.00 ... 0.0 0.98 0.0 \n", "2 2.04 1.00 ... 0.0 2.96 4.0 \n", "3 1.99 0.00 ... 0.0 0.00 0.0 \n", "4 3.47 0.00 ... 0.0 0.00 0.0 \n", "5 1.28 0.69 ... 0.0 0.00 0.0 \n", "6 0.24 0.00 ... 0.0 0.56 0.0 \n", "7 18.35 1.82 ... 0.0 8.70 2.0 \n", "8 0.00 0.00 ... 0.0 0.00 1.0 \n", "9 1.34 1.46 ... 0.0 0.00 0.0 \n", "\n", " arr_diverted arr_delay carrier_delay weather_delay nas_delay \\\n", "0 1.0 920.0 592.0 34.0 78.0 \n", "1 0.0 134.0 25.0 0.0 70.0 \n", "2 2.0 586.0 174.0 37.0 62.0 \n", "3 0.0 266.0 65.0 0.0 201.0 \n", "4 0.0 81.0 57.0 0.0 24.0 \n", "5 0.0 176.0 64.0 11.0 101.0 \n", "6 0.0 553.0 8.0 0.0 526.0 \n", "7 0.0 1910.0 707.0 114.0 386.0 \n", "8 0.0 0.0 0.0 0.0 0.0 \n", "9 0.0 547.0 85.0 89.0 373.0 \n", "\n", " security_delay late_aircraft_delay \n", "0 0.0 216.0 \n", "1 0.0 39.0 \n", "2 0.0 313.0 \n", "3 0.0 0.0 \n", "4 0.0 0.0 \n", "5 0.0 0.0 \n", "6 0.0 19.0 \n", "7 0.0 703.0 \n", "8 0.0 0.0 \n", "9 0.0 0.0 \n", "\n", "[10 rows x 21 columns]" ] }, "execution_count": 167, "metadata": {}, "output_type": "execute_result" } ], "source": [ "maindf.head(10)" ] }, { "cell_type": "code", "execution_count": 168, "metadata": {}, "outputs": [], "source": [ "season = maindf.set_index(' month').groupby(level=0).sum()" ] }, { "cell_type": "code", "execution_count": 169, "metadata": {}, "outputs": [], "source": [ "#Let's classify each month according to what season they belong. \n", "season_list = ['Winter', 'Winter', 'Spring', 'Spring', 'Spring', 'Summer',\n", " 'Summer','Summer', 'Fall', 'Fall', 'Fall', 'Winter']\n", "season['season'] = season_list" ] }, { "cell_type": "code", "execution_count": 170, "metadata": {}, "outputs": [], "source": [ "season['Toal No. of Delays'] = list(np.sum(season.iloc[:,3:8], axis=1))" ] }, { "cell_type": "code", "execution_count": 171, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
yeararr_flightsarr_del15carrier_ctweather_ctnas_ctsecurity_ctlate_aircraft_ctarr_cancelledarr_divertedarr_delaycarrier_delayweather_delaynas_delaysecurity_delaylate_aircraft_delayseasonToal No. of Delays
month
1262869605003725.0940632.0269868.3434788.07300533.862078.15333364.48143912.011863.055992069.017648065.03237030.013292328.087846.021726800.0Winter940632.90
2289517065109873.0947700.0262137.9932457.62317828.981678.34333598.64152163.011706.055421731.016800522.03030289.014163755.073100.021354065.0Winter947701.57
3255780335295087.0965403.0274431.4224002.72309844.171868.82355257.1592317.010851.054102640.016750864.02063992.013502611.068530.021716643.0Spring965404.28
4257774475110413.0899946.0249682.6424973.76295246.161534.69328509.0864034.011247.052453539.015710201.02277923.013560137.056562.020848716.0Spring899946.33
5255156445255897.0978608.0269082.0631622.09319143.131718.72357042.6761889.014261.057717664.016678287.02811017.015234498.066324.022927538.0Spring978608.67
6262809805331553.01182531.0334109.5242109.14348799.631987.73455525.0581797.017349.073834338.021607992.03726750.017585519.084823.030829254.0Summer1182531.07
7257833835513319.01209872.0345103.1943003.61350846.202007.58468912.6180894.017180.075536793.022286591.03632895.017872721.077322.031667264.0Summer1209873.19
8260876075454172.01070528.0308297.3235628.99321577.872208.85402814.4478847.014543.064681554.019779804.02917264.015606459.098777.026279056.0Summer1070527.47
9258216074959221.0726022.0210617.8920702.56244856.561308.84248537.8253883.09629.040278757.012951173.01617002.010564292.062629.015083661.0Fall726023.67
10255762725178013.0819560.0233194.7115604.41279873.591356.47289531.9852331.08553.043951145.013923859.01307822.011712200.054128.016953136.0Fall819561.16
11257754664921185.0722517.0213385.9715510.71237676.361494.14254450.4537784.08020.039010669.012834692.01352039.09659274.083315.015081349.0Fall722517.63
12260955675048905.01090593.0315854.2033005.22329933.652683.49409118.3195190.012129.062791162.019420704.02989235.014477237.099861.025804125.0Winter1090594.87
\n", "
" ], "text/plain": [ " year arr_flights arr_del15 carrier_ct weather_ct nas_ct \\\n", " month \n", "1 26286960 5003725.0 940632.0 269868.34 34788.07 300533.86 \n", "2 28951706 5109873.0 947700.0 262137.99 32457.62 317828.98 \n", "3 25578033 5295087.0 965403.0 274431.42 24002.72 309844.17 \n", "4 25777447 5110413.0 899946.0 249682.64 24973.76 295246.16 \n", "5 25515644 5255897.0 978608.0 269082.06 31622.09 319143.13 \n", "6 26280980 5331553.0 1182531.0 334109.52 42109.14 348799.63 \n", "7 25783383 5513319.0 1209872.0 345103.19 43003.61 350846.20 \n", "8 26087607 5454172.0 1070528.0 308297.32 35628.99 321577.87 \n", "9 25821607 4959221.0 726022.0 210617.89 20702.56 244856.56 \n", "10 25576272 5178013.0 819560.0 233194.71 15604.41 279873.59 \n", "11 25775466 4921185.0 722517.0 213385.97 15510.71 237676.36 \n", "12 26095567 5048905.0 1090593.0 315854.20 33005.22 329933.65 \n", "\n", " security_ct late_aircraft_ct arr_cancelled arr_diverted \\\n", " month \n", "1 2078.15 333364.48 143912.0 11863.0 \n", "2 1678.34 333598.64 152163.0 11706.0 \n", "3 1868.82 355257.15 92317.0 10851.0 \n", "4 1534.69 328509.08 64034.0 11247.0 \n", "5 1718.72 357042.67 61889.0 14261.0 \n", "6 1987.73 455525.05 81797.0 17349.0 \n", "7 2007.58 468912.61 80894.0 17180.0 \n", "8 2208.85 402814.44 78847.0 14543.0 \n", "9 1308.84 248537.82 53883.0 9629.0 \n", "10 1356.47 289531.98 52331.0 8553.0 \n", "11 1494.14 254450.45 37784.0 8020.0 \n", "12 2683.49 409118.31 95190.0 12129.0 \n", "\n", " arr_delay carrier_delay weather_delay nas_delay security_delay \\\n", " month \n", "1 55992069.0 17648065.0 3237030.0 13292328.0 87846.0 \n", "2 55421731.0 16800522.0 3030289.0 14163755.0 73100.0 \n", "3 54102640.0 16750864.0 2063992.0 13502611.0 68530.0 \n", "4 52453539.0 15710201.0 2277923.0 13560137.0 56562.0 \n", "5 57717664.0 16678287.0 2811017.0 15234498.0 66324.0 \n", "6 73834338.0 21607992.0 3726750.0 17585519.0 84823.0 \n", "7 75536793.0 22286591.0 3632895.0 17872721.0 77322.0 \n", "8 64681554.0 19779804.0 2917264.0 15606459.0 98777.0 \n", "9 40278757.0 12951173.0 1617002.0 10564292.0 62629.0 \n", "10 43951145.0 13923859.0 1307822.0 11712200.0 54128.0 \n", "11 39010669.0 12834692.0 1352039.0 9659274.0 83315.0 \n", "12 62791162.0 19420704.0 2989235.0 14477237.0 99861.0 \n", "\n", " late_aircraft_delay season Toal No. of Delays \n", " month \n", "1 21726800.0 Winter 940632.90 \n", "2 21354065.0 Winter 947701.57 \n", "3 21716643.0 Spring 965404.28 \n", "4 20848716.0 Spring 899946.33 \n", "5 22927538.0 Spring 978608.67 \n", "6 30829254.0 Summer 1182531.07 \n", "7 31667264.0 Summer 1209873.19 \n", "8 26279056.0 Summer 1070527.47 \n", "9 15083661.0 Fall 726023.67 \n", "10 16953136.0 Fall 819561.16 \n", "11 15081349.0 Fall 722517.63 \n", "12 25804125.0 Winter 1090594.87 " ] }, "execution_count": 171, "metadata": {}, "output_type": "execute_result" } ], "source": [ "season" ] }, { "cell_type": "code", "execution_count": 172, "metadata": {}, "outputs": [], "source": [ "plotdf = season.set_index('season').iloc[:, 2:8].groupby(level=0).sum()" ] }, { "cell_type": "code", "execution_count": 173, "metadata": { "scrolled": true }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "marker": { "color": "rgba(246, 78, 139, 0.6)", "line": { "color": "rgba(246, 78, 139, 1.0)", "width": 3 } }, "name": "Carrier Delay", "orientation": "h", "type": "bar", "uid": "71a8d719-fd99-4368-9103-2d50e2dd3391", "x": [ 657198.569999999, 793196.1200000008, 987510.030000001, 847860.5299999979 ], "y": [ "Fall", "Spring", "Summer", "Winter" ] }, { "marker": { "color": "rgba(178, 102, 255, 0.6)", "line": { "color": "rgba(178, 102, 255, 1.0)", "width": 3 } }, "name": "Weather Delay", "orientation": "h", "type": "bar", "uid": "52168fd9-e8ff-483c-8a3a-3ee40aec19e2", "x": [ 51817.68000000008, 80598.57000000018, 120741.7399999995, 100250.90999999992 ], "y": [ "Fall", "Spring", "Summer", "Winter" ] }, { "marker": { "color": "rgba(255, 178, 102, 0.6)", "line": { "color": "rgba(255, 178, 102, 1.0)", "width": 3 } }, "name": "National Air System Delay", "orientation": "h", "type": "bar", "uid": "d678a6e6-7841-42ae-8a33-7e55ebc703c7", "x": [ 762406.5100000008, 924233.4599999974, 1021223.7000000002, 948296.4899999964 ], "y": [ "Fall", "Spring", "Summer", "Winter" ] }, { "marker": { "color": "rgba(102, 204, 0, 0.6)", "line": { "color": "rgba(102, 204, 0, 1.0)", "width": 3 } }, "name": "Security Delay", "orientation": "h", "type": "bar", "uid": "772e9e55-5bec-4b1e-af89-fb4567914985", "x": [ 4159.45, 5122.2300000000005, 6204.1599999999935, 6439.980000000003 ], "y": [ "Fall", "Spring", "Summer", "Winter" ] }, { "marker": { "color": "rgba(51,153,255, 0.6)", "line": { "color": "rgba(51, 153, 255, 1.0)", "width": 3 } }, "name": "Late Aircraft Delay", "orientation": "h", "type": "bar", "uid": "aef0fbad-fb42-4ccc-a989-e032f63c587c", "x": [ 792520.2500000001, 1040808.8999999971, 1327252.0999999945, 1076081.4300000006 ], "y": [ "Fall", "Spring", "Summer", "Winter" ] } ], "layout": { "barmode": "stack", "title": { "text": "Amount of Delay by Season
2009-2019" }, "xaxis": { "title": { "text": "Total No. of Delays" } } } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig = go.Figure()\n", "fig.add_trace(go.Bar(\n", " y= list(plotdf.index), \n", " x= list(plotdf['carrier_ct']),\n", " name='Carrier Delay',\n", " orientation='h',\n", " marker=dict(\n", " color='rgba(246, 78, 139, 0.6)',\n", " line=dict(color='rgba(246, 78, 139, 1.0)', width=3)\n", " )))\n", " \n", "fig.add_trace(go.Bar(\n", " y= list(plotdf.index), \n", " x= list(plotdf[' weather_ct']),\n", " name='Weather Delay',\n", " orientation='h',\n", " marker=dict(\n", " color='rgba(178, 102, 255, 0.6)',\n", " line=dict(color='rgba(178, 102, 255, 1.0)', width=3)\n", " )))\n", "\n", "fig.add_trace(go.Bar(\n", " y= list(plotdf.index), \n", " x= list(plotdf['nas_ct']),\n", " name='National Air System Delay',\n", " orientation='h',\n", " marker=dict(\n", " color='rgba(255, 178, 102, 0.6)',\n", " line=dict(color='rgba(255, 178, 102, 1.0)', width=3)\n", " )\n", "))\n", " \n", "fig.add_trace(go.Bar(\n", " y= list(plotdf.index), \n", " x= list(plotdf['security_ct']),\n", " name='Security Delay',\n", " orientation='h',\n", " marker=dict(\n", " color='rgba(102, 204, 0, 0.6)',\n", " line=dict(color='rgba(102, 204, 0, 1.0)', width=3)\n", " )\n", "))\n", " \n", "fig.add_trace(go.Bar(\n", " y= list(plotdf.index), \n", " x= list(plotdf['late_aircraft_ct']),\n", " name='Late Aircraft Delay',\n", " orientation='h',\n", " marker=dict(\n", " color='rgba(51,153,255, 0.6)',\n", " line=dict(color='rgba(51, 153, 255, 1.0)', width=3)\n", " )\n", "))\n", " \n", "fig.layout.update(barmode='stack',\n", " title = 'Amount of Delay by Season
2009-2019',\n", " xaxis = dict(title = 'Total No. of Delays'))\n", "\n", "iplot(fig)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Thus, we can see that during the summer, there are more delays as compared to Spring and Winter, whereas there are minimum delays during Fall season! \n", "\n", "## End" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.7.1" } }, "nbformat": 4, "nbformat_minor": 2 }