Skip to content

Instantly share code, notes, and snippets.

@jayant91089
Created May 17, 2017 21:56
Show Gist options
  • Save jayant91089/11c3daf3d0a446e6d7ae25c1d4f8e620 to your computer and use it in GitHub Desktop.
Save jayant91089/11c3daf3d0a446e6d7ae25c1d4f8e620 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Import sqlite3 and pandas"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"import sqlite3\n",
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"engine = sqlite3.connect('HW1_DB')\n",
"airports = pd.read_sql('select * from airports', engine)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Step 4.1 Understanding the data I\n",
"### View dataframes, data types (using `info()` method), and summary (using `describe()` method) "
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>airport_id</th>\n",
" <th>airport_name</th>\n",
" <th>airport_city_main</th>\n",
" <th>airport_country</th>\n",
" <th>airport_faa_code</th>\n",
" <th>airport_icao_code</th>\n",
" <th>airport_x</th>\n",
" <th>airport_y</th>\n",
" <th>airport_alt</th>\n",
" <th>airport_tz_offset</th>\n",
" <th>airport_dst</th>\n",
" <th>airport_tz</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1</td>\n",
" <td>Goroka</td>\n",
" <td>Goroka</td>\n",
" <td>Papua New Guinea</td>\n",
" <td>GKA</td>\n",
" <td>AYGA</td>\n",
" <td>-6.081689</td>\n",
" <td>145.391881</td>\n",
" <td>5282</td>\n",
" <td>10.0</td>\n",
" <td>U</td>\n",
" <td>Pacific/Port_Moresby</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2</td>\n",
" <td>Madang</td>\n",
" <td>Madang</td>\n",
" <td>Papua New Guinea</td>\n",
" <td>MAG</td>\n",
" <td>AYMD</td>\n",
" <td>-5.207083</td>\n",
" <td>145.788700</td>\n",
" <td>20</td>\n",
" <td>10.0</td>\n",
" <td>U</td>\n",
" <td>Pacific/Port_Moresby</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3</td>\n",
" <td>Mount Hagen</td>\n",
" <td>Mount Hagen</td>\n",
" <td>Papua New Guinea</td>\n",
" <td>HGU</td>\n",
" <td>AYMH</td>\n",
" <td>-5.826789</td>\n",
" <td>144.295861</td>\n",
" <td>5388</td>\n",
" <td>10.0</td>\n",
" <td>U</td>\n",
" <td>Pacific/Port_Moresby</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>4</td>\n",
" <td>Nadzab</td>\n",
" <td>Nadzab</td>\n",
" <td>Papua New Guinea</td>\n",
" <td>LAE</td>\n",
" <td>AYNZ</td>\n",
" <td>-6.569828</td>\n",
" <td>146.726242</td>\n",
" <td>239</td>\n",
" <td>10.0</td>\n",
" <td>U</td>\n",
" <td>Pacific/Port_Moresby</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>5</td>\n",
" <td>Port Moresby Jacksons Intl</td>\n",
" <td>Port Moresby</td>\n",
" <td>Papua New Guinea</td>\n",
" <td>POM</td>\n",
" <td>AYPY</td>\n",
" <td>-9.443383</td>\n",
" <td>147.220050</td>\n",
" <td>146</td>\n",
" <td>10.0</td>\n",
" <td>U</td>\n",
" <td>Pacific/Port_Moresby</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>6</td>\n",
" <td>Wewak Intl</td>\n",
" <td>Wewak</td>\n",
" <td>Papua New Guinea</td>\n",
" <td>WWK</td>\n",
" <td>AYWK</td>\n",
" <td>-3.583828</td>\n",
" <td>143.669186</td>\n",
" <td>19</td>\n",
" <td>10.0</td>\n",
" <td>U</td>\n",
" <td>Pacific/Port_Moresby</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>7</td>\n",
" <td>Narsarsuaq</td>\n",
" <td>Narssarssuaq</td>\n",
" <td>Greenland</td>\n",
" <td>UAK</td>\n",
" <td>BGBW</td>\n",
" <td>61.160517</td>\n",
" <td>-45.425978</td>\n",
" <td>112</td>\n",
" <td>-3.0</td>\n",
" <td>E</td>\n",
" <td>America/Godthab</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>8</td>\n",
" <td>Nuuk</td>\n",
" <td>Godthaab</td>\n",
" <td>Greenland</td>\n",
" <td>GOH</td>\n",
" <td>BGGH</td>\n",
" <td>64.190922</td>\n",
" <td>-51.678064</td>\n",
" <td>283</td>\n",
" <td>-3.0</td>\n",
" <td>E</td>\n",
" <td>America/Godthab</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>9</td>\n",
" <td>Sondre Stromfjord</td>\n",
" <td>Sondrestrom</td>\n",
" <td>Greenland</td>\n",
" <td>SFJ</td>\n",
" <td>BGSF</td>\n",
" <td>67.016969</td>\n",
" <td>-50.689325</td>\n",
" <td>165</td>\n",
" <td>-3.0</td>\n",
" <td>E</td>\n",
" <td>America/Godthab</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>10</td>\n",
" <td>Thule Air Base</td>\n",
" <td>Thule</td>\n",
" <td>Greenland</td>\n",
" <td>THU</td>\n",
" <td>BGTL</td>\n",
" <td>76.531203</td>\n",
" <td>-68.703161</td>\n",
" <td>251</td>\n",
" <td>-4.0</td>\n",
" <td>E</td>\n",
" <td>America/Thule</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>11</td>\n",
" <td>Akureyri</td>\n",
" <td>Akureyri</td>\n",
" <td>Iceland</td>\n",
" <td>AEY</td>\n",
" <td>BIAR</td>\n",
" <td>65.659994</td>\n",
" <td>-18.072703</td>\n",
" <td>6</td>\n",
" <td>0.0</td>\n",
" <td>N</td>\n",
" <td>Atlantic/Reykjavik</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>12</td>\n",
" <td>Egilsstadir</td>\n",
" <td>Egilsstadir</td>\n",
" <td>Iceland</td>\n",
" <td>EGS</td>\n",
" <td>BIEG</td>\n",
" <td>65.283333</td>\n",
" <td>-14.401389</td>\n",
" <td>76</td>\n",
" <td>0.0</td>\n",
" <td>N</td>\n",
" <td>Atlantic/Reykjavik</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>13</td>\n",
" <td>Hornafjordur</td>\n",
" <td>Hofn</td>\n",
" <td>Iceland</td>\n",
" <td>HFN</td>\n",
" <td>BIHN</td>\n",
" <td>64.295556</td>\n",
" <td>-15.227222</td>\n",
" <td>24</td>\n",
" <td>0.0</td>\n",
" <td>N</td>\n",
" <td>Atlantic/Reykjavik</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>14</td>\n",
" <td>Husavik</td>\n",
" <td>Husavik</td>\n",
" <td>Iceland</td>\n",
" <td>HZK</td>\n",
" <td>BIHU</td>\n",
" <td>65.952328</td>\n",
" <td>-17.425978</td>\n",
" <td>48</td>\n",
" <td>0.0</td>\n",
" <td>N</td>\n",
" <td>Atlantic/Reykjavik</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>15</td>\n",
" <td>Isafjordur</td>\n",
" <td>Isafjordur</td>\n",
" <td>Iceland</td>\n",
" <td>IFJ</td>\n",
" <td>BIIS</td>\n",
" <td>66.058056</td>\n",
" <td>-23.135278</td>\n",
" <td>8</td>\n",
" <td>0.0</td>\n",
" <td>N</td>\n",
" <td>Atlantic/Reykjavik</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>16</td>\n",
" <td>Keflavik International Airport</td>\n",
" <td>Keflavik</td>\n",
" <td>Iceland</td>\n",
" <td>KEF</td>\n",
" <td>BIKF</td>\n",
" <td>63.985000</td>\n",
" <td>-22.605556</td>\n",
" <td>171</td>\n",
" <td>0.0</td>\n",
" <td>N</td>\n",
" <td>Atlantic/Reykjavik</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>17</td>\n",
" <td>Patreksfjordur</td>\n",
" <td>Patreksfjordur</td>\n",
" <td>Iceland</td>\n",
" <td>PFJ</td>\n",
" <td>BIPA</td>\n",
" <td>65.555833</td>\n",
" <td>-23.965000</td>\n",
" <td>11</td>\n",
" <td>0.0</td>\n",
" <td>N</td>\n",
" <td>Atlantic/Reykjavik</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>18</td>\n",
" <td>Reykjavik</td>\n",
" <td>Reykjavik</td>\n",
" <td>Iceland</td>\n",
" <td>RKV</td>\n",
" <td>BIRK</td>\n",
" <td>64.130000</td>\n",
" <td>-21.940556</td>\n",
" <td>48</td>\n",
" <td>0.0</td>\n",
" <td>N</td>\n",
" <td>Atlantic/Reykjavik</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>19</td>\n",
" <td>Siglufjordur</td>\n",
" <td>Siglufjordur</td>\n",
" <td>Iceland</td>\n",
" <td>SIJ</td>\n",
" <td>BISI</td>\n",
" <td>66.133333</td>\n",
" <td>-18.916667</td>\n",
" <td>10</td>\n",
" <td>0.0</td>\n",
" <td>N</td>\n",
" <td>Atlantic/Reykjavik</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>20</td>\n",
" <td>Vestmannaeyjar</td>\n",
" <td>Vestmannaeyjar</td>\n",
" <td>Iceland</td>\n",
" <td>VEY</td>\n",
" <td>BIVM</td>\n",
" <td>63.424303</td>\n",
" <td>-20.278875</td>\n",
" <td>326</td>\n",
" <td>0.0</td>\n",
" <td>N</td>\n",
" <td>Atlantic/Reykjavik</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>21</td>\n",
" <td>Sault Ste Marie</td>\n",
" <td>Sault Sainte Marie</td>\n",
" <td>Canada</td>\n",
" <td>YAM</td>\n",
" <td>CYAM</td>\n",
" <td>46.485001</td>\n",
" <td>-84.509445</td>\n",
" <td>630</td>\n",
" <td>-5.0</td>\n",
" <td>A</td>\n",
" <td>America/Toronto</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>22</td>\n",
" <td>Winnipeg St Andrews</td>\n",
" <td>Winnipeg</td>\n",
" <td>Canada</td>\n",
" <td>YAV</td>\n",
" <td>CYAV</td>\n",
" <td>50.056389</td>\n",
" <td>-97.032500</td>\n",
" <td>760</td>\n",
" <td>-6.0</td>\n",
" <td>A</td>\n",
" <td>America/Winnipeg</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>23</td>\n",
" <td>Shearwater</td>\n",
" <td>Halifax</td>\n",
" <td>Canada</td>\n",
" <td>YAW</td>\n",
" <td>CYAW</td>\n",
" <td>44.639721</td>\n",
" <td>-63.499444</td>\n",
" <td>167</td>\n",
" <td>-4.0</td>\n",
" <td>A</td>\n",
" <td>America/Halifax</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>24</td>\n",
" <td>St Anthony</td>\n",
" <td>St. Anthony</td>\n",
" <td>Canada</td>\n",
" <td>YAY</td>\n",
" <td>CYAY</td>\n",
" <td>51.391944</td>\n",
" <td>-56.083056</td>\n",
" <td>108</td>\n",
" <td>-3.5</td>\n",
" <td>A</td>\n",
" <td>America/St_Johns</td>\n",
" </tr>\n",
" <tr>\n",
" <th>24</th>\n",
" <td>25</td>\n",
" <td>Tofino</td>\n",
" <td>Tofino</td>\n",
" <td>Canada</td>\n",
" <td>YAZ</td>\n",
" <td>CYAZ</td>\n",
" <td>49.082222</td>\n",
" <td>-125.772500</td>\n",
" <td>80</td>\n",
" <td>-8.0</td>\n",
" <td>A</td>\n",
" <td>America/Vancouver</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
" <td>26</td>\n",
" <td>Kugaaruk</td>\n",
" <td>Pelly Bay</td>\n",
" <td>Canada</td>\n",
" <td>YBB</td>\n",
" <td>CYBB</td>\n",
" <td>68.534444</td>\n",
" <td>-89.808056</td>\n",
" <td>56</td>\n",
" <td>-7.0</td>\n",
" <td>A</td>\n",
" <td>America/Edmonton</td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
" <td>27</td>\n",
" <td>Baie Comeau</td>\n",
" <td>Baie Comeau</td>\n",
" <td>Canada</td>\n",
" <td>YBC</td>\n",
" <td>CYBC</td>\n",
" <td>49.132500</td>\n",
" <td>-68.204444</td>\n",
" <td>71</td>\n",
" <td>-5.0</td>\n",
" <td>A</td>\n",
" <td>America/Toronto</td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>28</td>\n",
" <td>Bagotville</td>\n",
" <td>Bagotville</td>\n",
" <td>Canada</td>\n",
" <td>YBG</td>\n",
" <td>CYBG</td>\n",
" <td>48.330555</td>\n",
" <td>-70.996391</td>\n",
" <td>522</td>\n",
" <td>-5.0</td>\n",
" <td>A</td>\n",
" <td>America/Toronto</td>\n",
" </tr>\n",
" <tr>\n",
" <th>28</th>\n",
" <td>29</td>\n",
" <td>Baker Lake</td>\n",
" <td>Baker Lake</td>\n",
" <td>Canada</td>\n",
" <td>YBK</td>\n",
" <td>CYBK</td>\n",
" <td>64.298889</td>\n",
" <td>-96.077778</td>\n",
" <td>59</td>\n",
" <td>-6.0</td>\n",
" <td>A</td>\n",
" <td>America/Winnipeg</td>\n",
" </tr>\n",
" <tr>\n",
" <th>29</th>\n",
" <td>30</td>\n",
" <td>Campbell River</td>\n",
" <td>Campbell River</td>\n",
" <td>Canada</td>\n",
" <td>YBL</td>\n",
" <td>CYBL</td>\n",
" <td>49.950832</td>\n",
" <td>-125.270833</td>\n",
" <td>346</td>\n",
" <td>-8.0</td>\n",
" <td>A</td>\n",
" <td>America/Vancouver</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8077</th>\n",
" <td>9512</td>\n",
" <td>Port of Seattle</td>\n",
" <td>Seattle</td>\n",
" <td>United States</td>\n",
" <td></td>\n",
" <td>PSEA</td>\n",
" <td>47.609178</td>\n",
" <td>-122.350605</td>\n",
" <td>0</td>\n",
" <td>-8.0</td>\n",
" <td>A</td>\n",
" <td>America/Los_Angeles</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8078</th>\n",
" <td>9513</td>\n",
" <td>Ferry Terminal</td>\n",
" <td>Whittier</td>\n",
" <td>United States</td>\n",
" <td></td>\n",
" <td>WHIT</td>\n",
" <td>60.776566</td>\n",
" <td>-148.683367</td>\n",
" <td>0</td>\n",
" <td>-9.0</td>\n",
" <td>A</td>\n",
" <td>America/Anchorage</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8079</th>\n",
" <td>9514</td>\n",
" <td>Ferry Terminal</td>\n",
" <td>Valdez</td>\n",
" <td>United States</td>\n",
" <td></td>\n",
" <td>VLDZ</td>\n",
" <td>61.123976</td>\n",
" <td>-146.365309</td>\n",
" <td>0</td>\n",
" <td>-9.0</td>\n",
" <td>A</td>\n",
" <td>America/Anchorage</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8080</th>\n",
" <td>9515</td>\n",
" <td>Gare Routiere</td>\n",
" <td>Saint-Louis</td>\n",
" <td>Reunion</td>\n",
" <td></td>\n",
" <td>STLS</td>\n",
" <td>-21.289604</td>\n",
" <td>55.407269</td>\n",
" <td>103</td>\n",
" <td>4.0</td>\n",
" <td>E</td>\n",
" <td>Indian/Reunion</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8081</th>\n",
" <td>9516</td>\n",
" <td>Bus Stop</td>\n",
" <td>La Riviere</td>\n",
" <td>Reunion</td>\n",
" <td></td>\n",
" <td>LRIV</td>\n",
" <td>-21.272574</td>\n",
" <td>55.437706</td>\n",
" <td>190</td>\n",
" <td>4.0</td>\n",
" <td>E</td>\n",
" <td>Indian/Reunion</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8082</th>\n",
" <td>9517</td>\n",
" <td>Bus Stop</td>\n",
" <td>Cilaos</td>\n",
" <td>Reunion</td>\n",
" <td></td>\n",
" <td>CILS</td>\n",
" <td>-21.135518</td>\n",
" <td>55.472087</td>\n",
" <td>4000</td>\n",
" <td>4.0</td>\n",
" <td>E</td>\n",
" <td>Indian/Reunion</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8083</th>\n",
" <td>9518</td>\n",
" <td>Bus Stop</td>\n",
" <td>Hell-Bourg</td>\n",
" <td>Reunion</td>\n",
" <td></td>\n",
" <td>HLBG</td>\n",
" <td>-21.064020</td>\n",
" <td>55.518453</td>\n",
" <td>3000</td>\n",
" <td>4.0</td>\n",
" <td>E</td>\n",
" <td>Indian/Reunion</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8084</th>\n",
" <td>9519</td>\n",
" <td>Bus Stop</td>\n",
" <td>Salazie</td>\n",
" <td>Reunion</td>\n",
" <td></td>\n",
" <td>SLZI</td>\n",
" <td>-21.027485</td>\n",
" <td>55.538955</td>\n",
" <td>3000</td>\n",
" <td>4.0</td>\n",
" <td>E</td>\n",
" <td>Indian/Reunion</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8085</th>\n",
" <td>9520</td>\n",
" <td>Gare</td>\n",
" <td>St Andre</td>\n",
" <td>Reunion</td>\n",
" <td></td>\n",
" <td>ANDR</td>\n",
" <td>-20.963272</td>\n",
" <td>55.652508</td>\n",
" <td>100</td>\n",
" <td>4.0</td>\n",
" <td>E</td>\n",
" <td>Indian/Reunion</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8086</th>\n",
" <td>9521</td>\n",
" <td>L'Ocean Bus Terminal</td>\n",
" <td>Saint Denis</td>\n",
" <td>Reunion</td>\n",
" <td></td>\n",
" <td>SDNS</td>\n",
" <td>-20.877683</td>\n",
" <td>55.457393</td>\n",
" <td>0</td>\n",
" <td>4.0</td>\n",
" <td>E</td>\n",
" <td>Indian/Reunion</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8087</th>\n",
" <td>9522</td>\n",
" <td>Gare Routiere</td>\n",
" <td>Saint Pierre</td>\n",
" <td>Reunion</td>\n",
" <td></td>\n",
" <td>STPR</td>\n",
" <td>-21.334240</td>\n",
" <td>55.471331</td>\n",
" <td>0</td>\n",
" <td>4.0</td>\n",
" <td>E</td>\n",
" <td>Indian/Reunion</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8088</th>\n",
" <td>9523</td>\n",
" <td>Baie Ste Anne</td>\n",
" <td>Praslin</td>\n",
" <td>Seychelles</td>\n",
" <td></td>\n",
" <td>PLIN</td>\n",
" <td>-4.347119</td>\n",
" <td>55.765688</td>\n",
" <td>0</td>\n",
" <td>4.0</td>\n",
" <td>N</td>\n",
" <td>Indian/Mahe</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8089</th>\n",
" <td>9524</td>\n",
" <td>La Passe</td>\n",
" <td>La Digue</td>\n",
" <td>Seychelles</td>\n",
" <td></td>\n",
" <td>LADG</td>\n",
" <td>-4.347969</td>\n",
" <td>55.829069</td>\n",
" <td>0</td>\n",
" <td>4.0</td>\n",
" <td>N</td>\n",
" <td>Indian/Mahe</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8090</th>\n",
" <td>9525</td>\n",
" <td>Ferry Dock</td>\n",
" <td>Bainbridge Island</td>\n",
" <td>United States</td>\n",
" <td></td>\n",
" <td>BAIN</td>\n",
" <td>47.622237</td>\n",
" <td>-122.509362</td>\n",
" <td>0</td>\n",
" <td>-8.0</td>\n",
" <td>A</td>\n",
" <td>America/Los_Angeles</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8091</th>\n",
" <td>9526</td>\n",
" <td>Bus</td>\n",
" <td>Phnom Penh</td>\n",
" <td>Cambodia</td>\n",
" <td></td>\n",
" <td>PNMP</td>\n",
" <td>11.561716</td>\n",
" <td>104.914276</td>\n",
" <td>0</td>\n",
" <td>7.0</td>\n",
" <td>N</td>\n",
" <td>Asia/Phnom_Penh</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8092</th>\n",
" <td>9527</td>\n",
" <td>Bus</td>\n",
" <td>Siem Reap</td>\n",
" <td>Cambodia</td>\n",
" <td></td>\n",
" <td>SMRP</td>\n",
" <td>13.361002</td>\n",
" <td>103.859543</td>\n",
" <td>0</td>\n",
" <td>7.0</td>\n",
" <td>N</td>\n",
" <td>Asia/Phnom_Penh</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8093</th>\n",
" <td>9528</td>\n",
" <td>Bus</td>\n",
" <td>Sihanoukville</td>\n",
" <td>Cambodia</td>\n",
" <td></td>\n",
" <td>SNKV</td>\n",
" <td>10.607220</td>\n",
" <td>103.524886</td>\n",
" <td>0</td>\n",
" <td>7.0</td>\n",
" <td>N</td>\n",
" <td>Asia/Phnom_Penh</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8094</th>\n",
" <td>9529</td>\n",
" <td>Bus</td>\n",
" <td>Kampot</td>\n",
" <td>Cambodia</td>\n",
" <td></td>\n",
" <td>KMPT</td>\n",
" <td>10.614922</td>\n",
" <td>104.177724</td>\n",
" <td>0</td>\n",
" <td>7.0</td>\n",
" <td>N</td>\n",
" <td>Asia/Phnom_Penh</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8095</th>\n",
" <td>9530</td>\n",
" <td>Bus</td>\n",
" <td>Kep</td>\n",
" <td>Cambodia</td>\n",
" <td></td>\n",
" <td>KEPC</td>\n",
" <td>10.480174</td>\n",
" <td>104.294228</td>\n",
" <td>0</td>\n",
" <td>7.0</td>\n",
" <td>N</td>\n",
" <td>Asia/Phnom_Penh</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8096</th>\n",
" <td>9531</td>\n",
" <td>Main Station</td>\n",
" <td>Taipei</td>\n",
" <td>Taiwan</td>\n",
" <td></td>\n",
" <td>TPEI</td>\n",
" <td>25.046176</td>\n",
" <td>121.517532</td>\n",
" <td>0</td>\n",
" <td>8.0</td>\n",
" <td>N</td>\n",
" <td>Asia/Taipei</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8097</th>\n",
" <td>9532</td>\n",
" <td>Prominent Hill</td>\n",
" <td>Prominent Hill</td>\n",
" <td>Australia</td>\n",
" <td>PXH</td>\n",
" <td>YPMH</td>\n",
" <td>-29.716667</td>\n",
" <td>135.521667</td>\n",
" <td>734</td>\n",
" <td>9.5</td>\n",
" <td>O</td>\n",
" <td>Australia/Adelaide</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8098</th>\n",
" <td>9533</td>\n",
" <td>Chatsworth Station</td>\n",
" <td>Chatsworth</td>\n",
" <td>United States</td>\n",
" <td>CWT</td>\n",
" <td></td>\n",
" <td>34.256944</td>\n",
" <td>-118.598889</td>\n",
" <td>978</td>\n",
" <td>-8.0</td>\n",
" <td>A</td>\n",
" <td>America/Los_Angeles</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8099</th>\n",
" <td>9534</td>\n",
" <td>Algerciras Port</td>\n",
" <td>Algerciras</td>\n",
" <td>Spain</td>\n",
" <td></td>\n",
" <td></td>\n",
" <td>36.136000</td>\n",
" <td>-5.435000</td>\n",
" <td>0</td>\n",
" <td>1.0</td>\n",
" <td>E</td>\n",
" <td>Europe/Madrid</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8100</th>\n",
" <td>9535</td>\n",
" <td>Ganges Water Aerodrome</td>\n",
" <td>Ganges</td>\n",
" <td>Canada</td>\n",
" <td>YGG</td>\n",
" <td></td>\n",
" <td>48.850000</td>\n",
" <td>-123.500000</td>\n",
" <td>0</td>\n",
" <td>-8.0</td>\n",
" <td>A</td>\n",
" <td>America/Vancouver</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8101</th>\n",
" <td>9536</td>\n",
" <td>Pender Harbour Water Aerodrome</td>\n",
" <td>Pender Harbour</td>\n",
" <td>Canada</td>\n",
" <td>YPT</td>\n",
" <td></td>\n",
" <td>49.616667</td>\n",
" <td>-124.016667</td>\n",
" <td>0</td>\n",
" <td>-8.0</td>\n",
" <td>A</td>\n",
" <td>America/Vancouver</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8102</th>\n",
" <td>9537</td>\n",
" <td>Mansons Landing Water Aerodrome</td>\n",
" <td>Mansons Landing</td>\n",
" <td>Canada</td>\n",
" <td>YMU</td>\n",
" <td></td>\n",
" <td>50.066667</td>\n",
" <td>-124.983333</td>\n",
" <td>0</td>\n",
" <td>-8.0</td>\n",
" <td>A</td>\n",
" <td>America/Vancouver</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8103</th>\n",
" <td>9538</td>\n",
" <td>Port McNeill Airport</td>\n",
" <td>Port McNeill</td>\n",
" <td>Canada</td>\n",
" <td>YMP</td>\n",
" <td></td>\n",
" <td>50.575556</td>\n",
" <td>-127.028611</td>\n",
" <td>225</td>\n",
" <td>-8.0</td>\n",
" <td>A</td>\n",
" <td>America/Vancouver</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8104</th>\n",
" <td>9539</td>\n",
" <td>Sullivan Bay Water Aerodrome</td>\n",
" <td>Sullivan Bay</td>\n",
" <td>Canada</td>\n",
" <td>YTG</td>\n",
" <td></td>\n",
" <td>50.883333</td>\n",
" <td>-126.833333</td>\n",
" <td>0</td>\n",
" <td>-8.0</td>\n",
" <td>A</td>\n",
" <td>America/Vancouver</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8105</th>\n",
" <td>9540</td>\n",
" <td>Deer Harbor Seaplane</td>\n",
" <td>Deer Harbor</td>\n",
" <td>United States</td>\n",
" <td>DHB</td>\n",
" <td></td>\n",
" <td>48.618397</td>\n",
" <td>-123.005960</td>\n",
" <td>0</td>\n",
" <td>-8.0</td>\n",
" <td>A</td>\n",
" <td>America/Los_Angeles</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8106</th>\n",
" <td>9541</td>\n",
" <td>San Diego Old Town Transit Center</td>\n",
" <td>San Diego</td>\n",
" <td>United States</td>\n",
" <td>OLT</td>\n",
" <td></td>\n",
" <td>32.755200</td>\n",
" <td>-117.199500</td>\n",
" <td>0</td>\n",
" <td>-8.0</td>\n",
" <td>A</td>\n",
" <td>America/Los_Angeles</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>8107 rows × 12 columns</p>\n",
"</div>"
],
"text/plain": [
" airport_id airport_name airport_city_main \\\n",
"0 1 Goroka Goroka \n",
"1 2 Madang Madang \n",
"2 3 Mount Hagen Mount Hagen \n",
"3 4 Nadzab Nadzab \n",
"4 5 Port Moresby Jacksons Intl Port Moresby \n",
"5 6 Wewak Intl Wewak \n",
"6 7 Narsarsuaq Narssarssuaq \n",
"7 8 Nuuk Godthaab \n",
"8 9 Sondre Stromfjord Sondrestrom \n",
"9 10 Thule Air Base Thule \n",
"10 11 Akureyri Akureyri \n",
"11 12 Egilsstadir Egilsstadir \n",
"12 13 Hornafjordur Hofn \n",
"13 14 Husavik Husavik \n",
"14 15 Isafjordur Isafjordur \n",
"15 16 Keflavik International Airport Keflavik \n",
"16 17 Patreksfjordur Patreksfjordur \n",
"17 18 Reykjavik Reykjavik \n",
"18 19 Siglufjordur Siglufjordur \n",
"19 20 Vestmannaeyjar Vestmannaeyjar \n",
"20 21 Sault Ste Marie Sault Sainte Marie \n",
"21 22 Winnipeg St Andrews Winnipeg \n",
"22 23 Shearwater Halifax \n",
"23 24 St Anthony St. Anthony \n",
"24 25 Tofino Tofino \n",
"25 26 Kugaaruk Pelly Bay \n",
"26 27 Baie Comeau Baie Comeau \n",
"27 28 Bagotville Bagotville \n",
"28 29 Baker Lake Baker Lake \n",
"29 30 Campbell River Campbell River \n",
"... ... ... ... \n",
"8077 9512 Port of Seattle Seattle \n",
"8078 9513 Ferry Terminal Whittier \n",
"8079 9514 Ferry Terminal Valdez \n",
"8080 9515 Gare Routiere Saint-Louis \n",
"8081 9516 Bus Stop La Riviere \n",
"8082 9517 Bus Stop Cilaos \n",
"8083 9518 Bus Stop Hell-Bourg \n",
"8084 9519 Bus Stop Salazie \n",
"8085 9520 Gare St Andre \n",
"8086 9521 L'Ocean Bus Terminal Saint Denis \n",
"8087 9522 Gare Routiere Saint Pierre \n",
"8088 9523 Baie Ste Anne Praslin \n",
"8089 9524 La Passe La Digue \n",
"8090 9525 Ferry Dock Bainbridge Island \n",
"8091 9526 Bus Phnom Penh \n",
"8092 9527 Bus Siem Reap \n",
"8093 9528 Bus Sihanoukville \n",
"8094 9529 Bus Kampot \n",
"8095 9530 Bus Kep \n",
"8096 9531 Main Station Taipei \n",
"8097 9532 Prominent Hill Prominent Hill \n",
"8098 9533 Chatsworth Station Chatsworth \n",
"8099 9534 Algerciras Port Algerciras \n",
"8100 9535 Ganges Water Aerodrome Ganges \n",
"8101 9536 Pender Harbour Water Aerodrome Pender Harbour \n",
"8102 9537 Mansons Landing Water Aerodrome Mansons Landing \n",
"8103 9538 Port McNeill Airport Port McNeill \n",
"8104 9539 Sullivan Bay Water Aerodrome Sullivan Bay \n",
"8105 9540 Deer Harbor Seaplane Deer Harbor \n",
"8106 9541 San Diego Old Town Transit Center San Diego \n",
"\n",
" airport_country airport_faa_code airport_icao_code airport_x \\\n",
"0 Papua New Guinea GKA AYGA -6.081689 \n",
"1 Papua New Guinea MAG AYMD -5.207083 \n",
"2 Papua New Guinea HGU AYMH -5.826789 \n",
"3 Papua New Guinea LAE AYNZ -6.569828 \n",
"4 Papua New Guinea POM AYPY -9.443383 \n",
"5 Papua New Guinea WWK AYWK -3.583828 \n",
"6 Greenland UAK BGBW 61.160517 \n",
"7 Greenland GOH BGGH 64.190922 \n",
"8 Greenland SFJ BGSF 67.016969 \n",
"9 Greenland THU BGTL 76.531203 \n",
"10 Iceland AEY BIAR 65.659994 \n",
"11 Iceland EGS BIEG 65.283333 \n",
"12 Iceland HFN BIHN 64.295556 \n",
"13 Iceland HZK BIHU 65.952328 \n",
"14 Iceland IFJ BIIS 66.058056 \n",
"15 Iceland KEF BIKF 63.985000 \n",
"16 Iceland PFJ BIPA 65.555833 \n",
"17 Iceland RKV BIRK 64.130000 \n",
"18 Iceland SIJ BISI 66.133333 \n",
"19 Iceland VEY BIVM 63.424303 \n",
"20 Canada YAM CYAM 46.485001 \n",
"21 Canada YAV CYAV 50.056389 \n",
"22 Canada YAW CYAW 44.639721 \n",
"23 Canada YAY CYAY 51.391944 \n",
"24 Canada YAZ CYAZ 49.082222 \n",
"25 Canada YBB CYBB 68.534444 \n",
"26 Canada YBC CYBC 49.132500 \n",
"27 Canada YBG CYBG 48.330555 \n",
"28 Canada YBK CYBK 64.298889 \n",
"29 Canada YBL CYBL 49.950832 \n",
"... ... ... ... ... \n",
"8077 United States PSEA 47.609178 \n",
"8078 United States WHIT 60.776566 \n",
"8079 United States VLDZ 61.123976 \n",
"8080 Reunion STLS -21.289604 \n",
"8081 Reunion LRIV -21.272574 \n",
"8082 Reunion CILS -21.135518 \n",
"8083 Reunion HLBG -21.064020 \n",
"8084 Reunion SLZI -21.027485 \n",
"8085 Reunion ANDR -20.963272 \n",
"8086 Reunion SDNS -20.877683 \n",
"8087 Reunion STPR -21.334240 \n",
"8088 Seychelles PLIN -4.347119 \n",
"8089 Seychelles LADG -4.347969 \n",
"8090 United States BAIN 47.622237 \n",
"8091 Cambodia PNMP 11.561716 \n",
"8092 Cambodia SMRP 13.361002 \n",
"8093 Cambodia SNKV 10.607220 \n",
"8094 Cambodia KMPT 10.614922 \n",
"8095 Cambodia KEPC 10.480174 \n",
"8096 Taiwan TPEI 25.046176 \n",
"8097 Australia PXH YPMH -29.716667 \n",
"8098 United States CWT 34.256944 \n",
"8099 Spain 36.136000 \n",
"8100 Canada YGG 48.850000 \n",
"8101 Canada YPT 49.616667 \n",
"8102 Canada YMU 50.066667 \n",
"8103 Canada YMP 50.575556 \n",
"8104 Canada YTG 50.883333 \n",
"8105 United States DHB 48.618397 \n",
"8106 United States OLT 32.755200 \n",
"\n",
" airport_y airport_alt airport_tz_offset airport_dst \\\n",
"0 145.391881 5282 10.0 U \n",
"1 145.788700 20 10.0 U \n",
"2 144.295861 5388 10.0 U \n",
"3 146.726242 239 10.0 U \n",
"4 147.220050 146 10.0 U \n",
"5 143.669186 19 10.0 U \n",
"6 -45.425978 112 -3.0 E \n",
"7 -51.678064 283 -3.0 E \n",
"8 -50.689325 165 -3.0 E \n",
"9 -68.703161 251 -4.0 E \n",
"10 -18.072703 6 0.0 N \n",
"11 -14.401389 76 0.0 N \n",
"12 -15.227222 24 0.0 N \n",
"13 -17.425978 48 0.0 N \n",
"14 -23.135278 8 0.0 N \n",
"15 -22.605556 171 0.0 N \n",
"16 -23.965000 11 0.0 N \n",
"17 -21.940556 48 0.0 N \n",
"18 -18.916667 10 0.0 N \n",
"19 -20.278875 326 0.0 N \n",
"20 -84.509445 630 -5.0 A \n",
"21 -97.032500 760 -6.0 A \n",
"22 -63.499444 167 -4.0 A \n",
"23 -56.083056 108 -3.5 A \n",
"24 -125.772500 80 -8.0 A \n",
"25 -89.808056 56 -7.0 A \n",
"26 -68.204444 71 -5.0 A \n",
"27 -70.996391 522 -5.0 A \n",
"28 -96.077778 59 -6.0 A \n",
"29 -125.270833 346 -8.0 A \n",
"... ... ... ... ... \n",
"8077 -122.350605 0 -8.0 A \n",
"8078 -148.683367 0 -9.0 A \n",
"8079 -146.365309 0 -9.0 A \n",
"8080 55.407269 103 4.0 E \n",
"8081 55.437706 190 4.0 E \n",
"8082 55.472087 4000 4.0 E \n",
"8083 55.518453 3000 4.0 E \n",
"8084 55.538955 3000 4.0 E \n",
"8085 55.652508 100 4.0 E \n",
"8086 55.457393 0 4.0 E \n",
"8087 55.471331 0 4.0 E \n",
"8088 55.765688 0 4.0 N \n",
"8089 55.829069 0 4.0 N \n",
"8090 -122.509362 0 -8.0 A \n",
"8091 104.914276 0 7.0 N \n",
"8092 103.859543 0 7.0 N \n",
"8093 103.524886 0 7.0 N \n",
"8094 104.177724 0 7.0 N \n",
"8095 104.294228 0 7.0 N \n",
"8096 121.517532 0 8.0 N \n",
"8097 135.521667 734 9.5 O \n",
"8098 -118.598889 978 -8.0 A \n",
"8099 -5.435000 0 1.0 E \n",
"8100 -123.500000 0 -8.0 A \n",
"8101 -124.016667 0 -8.0 A \n",
"8102 -124.983333 0 -8.0 A \n",
"8103 -127.028611 225 -8.0 A \n",
"8104 -126.833333 0 -8.0 A \n",
"8105 -123.005960 0 -8.0 A \n",
"8106 -117.199500 0 -8.0 A \n",
"\n",
" airport_tz \n",
"0 Pacific/Port_Moresby \n",
"1 Pacific/Port_Moresby \n",
"2 Pacific/Port_Moresby \n",
"3 Pacific/Port_Moresby \n",
"4 Pacific/Port_Moresby \n",
"5 Pacific/Port_Moresby \n",
"6 America/Godthab \n",
"7 America/Godthab \n",
"8 America/Godthab \n",
"9 America/Thule \n",
"10 Atlantic/Reykjavik \n",
"11 Atlantic/Reykjavik \n",
"12 Atlantic/Reykjavik \n",
"13 Atlantic/Reykjavik \n",
"14 Atlantic/Reykjavik \n",
"15 Atlantic/Reykjavik \n",
"16 Atlantic/Reykjavik \n",
"17 Atlantic/Reykjavik \n",
"18 Atlantic/Reykjavik \n",
"19 Atlantic/Reykjavik \n",
"20 America/Toronto \n",
"21 America/Winnipeg \n",
"22 America/Halifax \n",
"23 America/St_Johns \n",
"24 America/Vancouver \n",
"25 America/Edmonton \n",
"26 America/Toronto \n",
"27 America/Toronto \n",
"28 America/Winnipeg \n",
"29 America/Vancouver \n",
"... ... \n",
"8077 America/Los_Angeles \n",
"8078 America/Anchorage \n",
"8079 America/Anchorage \n",
"8080 Indian/Reunion \n",
"8081 Indian/Reunion \n",
"8082 Indian/Reunion \n",
"8083 Indian/Reunion \n",
"8084 Indian/Reunion \n",
"8085 Indian/Reunion \n",
"8086 Indian/Reunion \n",
"8087 Indian/Reunion \n",
"8088 Indian/Mahe \n",
"8089 Indian/Mahe \n",
"8090 America/Los_Angeles \n",
"8091 Asia/Phnom_Penh \n",
"8092 Asia/Phnom_Penh \n",
"8093 Asia/Phnom_Penh \n",
"8094 Asia/Phnom_Penh \n",
"8095 Asia/Phnom_Penh \n",
"8096 Asia/Taipei \n",
"8097 Australia/Adelaide \n",
"8098 America/Los_Angeles \n",
"8099 Europe/Madrid \n",
"8100 America/Vancouver \n",
"8101 America/Vancouver \n",
"8102 America/Vancouver \n",
"8103 America/Vancouver \n",
"8104 America/Vancouver \n",
"8105 America/Los_Angeles \n",
"8106 America/Los_Angeles \n",
"\n",
"[8107 rows x 12 columns]"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"airports"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"airlines = pd.read_sql('select * from airlines', engine)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"routes = pd.read_sql('select * from routes', engine)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 8107 entries, 0 to 8106\n",
"Data columns (total 12 columns):\n",
"airport_id 8107 non-null int64\n",
"airport_name 8107 non-null object\n",
"airport_city_main 8107 non-null object\n",
"airport_country 8107 non-null object\n",
"airport_faa_code 8107 non-null object\n",
"airport_icao_code 8107 non-null object\n",
"airport_x 8107 non-null float64\n",
"airport_y 8107 non-null float64\n",
"airport_alt 8107 non-null int64\n",
"airport_tz_offset 8107 non-null float64\n",
"airport_dst 8107 non-null object\n",
"airport_tz 8107 non-null object\n",
"dtypes: float64(3), int64(2), object(7)\n",
"memory usage: 760.1+ KB\n"
]
}
],
"source": [
"airports.info()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 6048 entries, 0 to 6047\n",
"Data columns (total 8 columns):\n",
"airline_id 6048 non-null int64\n",
"airline_name 6048 non-null object\n",
"airline_alias 6048 non-null object\n",
"airline_iata2_code 6048 non-null object\n",
"airline_icao3_code 6048 non-null object\n",
"airline_callsign 6048 non-null object\n",
"airline_country 6048 non-null object\n",
"airline_active 6048 non-null object\n",
"dtypes: int64(1), object(7)\n",
"memory usage: 378.1+ KB\n"
]
}
],
"source": [
"airlines.info()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.frame.DataFrame'>\n",
"RangeIndex: 66548 entries, 0 to 66547\n",
"Data columns (total 9 columns):\n",
"route_iata_code 66548 non-null object\n",
"route_airline_id 66548 non-null int64\n",
"route_src 66548 non-null object\n",
"route_src_id 66548 non-null object\n",
"route_dest 66548 non-null object\n",
"route_dest_id 66548 non-null object\n",
"route_codeshare 66548 non-null object\n",
"route_nstops 66548 non-null int64\n",
"route_equip 66548 non-null object\n",
"dtypes: int64(2), object(7)\n",
"memory usage: 4.6+ MB\n"
]
}
],
"source": [
"routes.info()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>airport_id</th>\n",
" <th>airport_x</th>\n",
" <th>airport_y</th>\n",
" <th>airport_alt</th>\n",
" <th>airport_tz_offset</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>8107.000000</td>\n",
" <td>8107.000000</td>\n",
" <td>8107.000000</td>\n",
" <td>8107.000000</td>\n",
" <td>8107.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>4766.361046</td>\n",
" <td>26.817720</td>\n",
" <td>-3.921969</td>\n",
" <td>933.449365</td>\n",
" <td>0.169236</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>2943.205193</td>\n",
" <td>27.866953</td>\n",
" <td>85.900873</td>\n",
" <td>1624.740899</td>\n",
" <td>5.737326</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>1.000000</td>\n",
" <td>-89.999997</td>\n",
" <td>-179.877000</td>\n",
" <td>-1266.000000</td>\n",
" <td>-12.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>2091.500000</td>\n",
" <td>8.824928</td>\n",
" <td>-79.022498</td>\n",
" <td>38.000000</td>\n",
" <td>-5.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>4257.000000</td>\n",
" <td>34.987800</td>\n",
" <td>5.292028</td>\n",
" <td>272.000000</td>\n",
" <td>1.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>7508.500000</td>\n",
" <td>47.957599</td>\n",
" <td>49.785821</td>\n",
" <td>1020.000000</td>\n",
" <td>4.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>9541.000000</td>\n",
" <td>82.517778</td>\n",
" <td>179.951000</td>\n",
" <td>14472.000000</td>\n",
" <td>13.000000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" airport_id airport_x airport_y airport_alt airport_tz_offset\n",
"count 8107.000000 8107.000000 8107.000000 8107.000000 8107.000000\n",
"mean 4766.361046 26.817720 -3.921969 933.449365 0.169236\n",
"std 2943.205193 27.866953 85.900873 1624.740899 5.737326\n",
"min 1.000000 -89.999997 -179.877000 -1266.000000 -12.000000\n",
"25% 2091.500000 8.824928 -79.022498 38.000000 -5.000000\n",
"50% 4257.000000 34.987800 5.292028 272.000000 1.000000\n",
"75% 7508.500000 47.957599 49.785821 1020.000000 4.000000\n",
"max 9541.000000 82.517778 179.951000 14472.000000 13.000000"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"airports.describe()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"routes['route_src_id'] = routes['route_src_id'].astype(int)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"routes['route_dest_id'] = routes['route_dest_id'].astype(int)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>airline_id</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>6048.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>3844.729167</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>3945.495487</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>-1.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>1512.750000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>3025.500000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>4543.250000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>19845.000000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" airline_id\n",
"count 6048.000000\n",
"mean 3844.729167\n",
"std 3945.495487\n",
"min -1.000000\n",
"25% 1512.750000\n",
"50% 3025.500000\n",
"75% 4543.250000\n",
"max 19845.000000"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"airlines.describe()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>airport_id</th>\n",
" <th>airport_x</th>\n",
" <th>airport_y</th>\n",
" <th>airport_alt</th>\n",
" <th>airport_tz_offset</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>8107.000000</td>\n",
" <td>8107.000000</td>\n",
" <td>8107.000000</td>\n",
" <td>8107.000000</td>\n",
" <td>8107.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>4766.361046</td>\n",
" <td>26.817720</td>\n",
" <td>-3.921969</td>\n",
" <td>933.449365</td>\n",
" <td>0.169236</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>2943.205193</td>\n",
" <td>27.866953</td>\n",
" <td>85.900873</td>\n",
" <td>1624.740899</td>\n",
" <td>5.737326</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>1.000000</td>\n",
" <td>-89.999997</td>\n",
" <td>-179.877000</td>\n",
" <td>-1266.000000</td>\n",
" <td>-12.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>2091.500000</td>\n",
" <td>8.824928</td>\n",
" <td>-79.022498</td>\n",
" <td>38.000000</td>\n",
" <td>-5.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>4257.000000</td>\n",
" <td>34.987800</td>\n",
" <td>5.292028</td>\n",
" <td>272.000000</td>\n",
" <td>1.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>7508.500000</td>\n",
" <td>47.957599</td>\n",
" <td>49.785821</td>\n",
" <td>1020.000000</td>\n",
" <td>4.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>9541.000000</td>\n",
" <td>82.517778</td>\n",
" <td>179.951000</td>\n",
" <td>14472.000000</td>\n",
" <td>13.000000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" airport_id airport_x airport_y airport_alt airport_tz_offset\n",
"count 8107.000000 8107.000000 8107.000000 8107.000000 8107.000000\n",
"mean 4766.361046 26.817720 -3.921969 933.449365 0.169236\n",
"std 2943.205193 27.866953 85.900873 1624.740899 5.737326\n",
"min 1.000000 -89.999997 -179.877000 -1266.000000 -12.000000\n",
"25% 2091.500000 8.824928 -79.022498 38.000000 -5.000000\n",
"50% 4257.000000 34.987800 5.292028 272.000000 1.000000\n",
"75% 7508.500000 47.957599 49.785821 1020.000000 4.000000\n",
"max 9541.000000 82.517778 179.951000 14472.000000 13.000000"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"airports.describe()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>route_airline_id</th>\n",
" <th>route_src_id</th>\n",
" <th>route_dest_id</th>\n",
" <th>route_nstops</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>count</th>\n",
" <td>66548.000000</td>\n",
" <td>66548.000000</td>\n",
" <td>66548.000000</td>\n",
" <td>66548.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>mean</th>\n",
" <td>3367.569754</td>\n",
" <td>2660.201929</td>\n",
" <td>2662.088192</td>\n",
" <td>0.000165</td>\n",
" </tr>\n",
" <tr>\n",
" <th>std</th>\n",
" <td>3182.024330</td>\n",
" <td>1577.965637</td>\n",
" <td>1578.661433</td>\n",
" <td>0.012856</td>\n",
" </tr>\n",
" <tr>\n",
" <th>min</th>\n",
" <td>10.000000</td>\n",
" <td>1.000000</td>\n",
" <td>1.000000</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25%</th>\n",
" <td>1317.000000</td>\n",
" <td>1382.000000</td>\n",
" <td>1382.000000</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50%</th>\n",
" <td>2942.000000</td>\n",
" <td>2958.000000</td>\n",
" <td>2958.000000</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75%</th>\n",
" <td>4608.000000</td>\n",
" <td>3670.000000</td>\n",
" <td>3670.000000</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>max</th>\n",
" <td>19676.000000</td>\n",
" <td>9327.000000</td>\n",
" <td>9327.000000</td>\n",
" <td>1.000000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" route_airline_id route_src_id route_dest_id route_nstops\n",
"count 66548.000000 66548.000000 66548.000000 66548.000000\n",
"mean 3367.569754 2660.201929 2662.088192 0.000165\n",
"std 3182.024330 1577.965637 1578.661433 0.012856\n",
"min 10.000000 1.000000 1.000000 0.000000\n",
"25% 1317.000000 1382.000000 1382.000000 0.000000\n",
"50% 2942.000000 2958.000000 2958.000000 0.000000\n",
"75% 4608.000000 3670.000000 3670.000000 0.000000\n",
"max 19676.000000 9327.000000 9327.000000 1.000000"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"routes.describe()"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"all_airport_ids = airports['airport_id']"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"8107"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(all_airport_ids.unique())"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"all_source_ids = routes['route_src_id']"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"3167"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(all_source_ids.unique())"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"all_dest_ids = routes['route_dest_id']"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"3170"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(all_dest_ids.unique())"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"{'airports': 8107, 'destinations': 3170, 'sources': 3167}"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"{'airports': 8107, 'destinations': 3170, 'sources': 3167}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Step 4.2 Understanding the data II\n",
"\n",
"### Print airports that serve both as source or destination and the rest"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"6337\n",
"1770\n"
]
}
],
"source": [
"src_or_dest = pd.concat([airports[airports.airport_id.isin(routes.route_src_id)],\n",
" airports[airports.airport_id.isin(routes.route_dest_id)]])\n",
"print(list(src_or_dest.shape)[0])\n",
"print(list(airports.shape)[0]-list(src_or_dest.shape)[0])"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"(3155, 12)"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# airports serving as both source and destination\n",
"source_and_dest = pd.merge(airports[airports.airport_id.isin(routes.route_src_id)],\n",
" airports[airports.airport_id.isin(routes.route_dest_id)],how='inner')\n",
"source_and_dest.shape"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"#airport ids by number of incoming flights\n",
"dest_df = pd.DataFrame(routes[routes.route_dest_id.isin(airports[airports.airport_id.isin(routes.route_dest_id)].airport_id)].route_dest_id)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"incoming_counts_df = dest_df.route_dest_id.value_counts().to_frame()"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"incoming_counts_df.columns = ['counts']"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"incoming_counts_df['airport_id']=incoming_counts_df.index\n",
"incoming_counts_df.index=range(list(incoming_counts_df.shape)[0])\n",
"incoming_counts_df = incoming_counts_df.sort_values('counts')"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x7f883bec21d0>]"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAh8AAAFkCAYAAACAUFlOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzt3Xu0XWV57/Hvk5CEiyYBLDtGBKNBiL2ACSZQhEMFDiIt\nxeJQtrcWbTkqsZycdggM7TDA6OWgJZQKLUOpPYruDgoKqJEUECnXRJNICwREkxBiSLjFTUggN97z\nx5ybrGyy1trJnmvOtdb+fsZYY+0955u1n/mOmexf3vedc0ZKCUmSpLKMqroASZI0shg+JElSqQwf\nkiSpVIYPSZJUKsOHJEkqleFDkiSVyvAhSZJKZfiQJEmlMnxIkqRSGT4kSVKpdjt8RMTxEXFLRPwq\nIl6JiDN20eaSiFgTEZsi4raImDpo/7iIuCoino2IDRFxQ0QcNKjN/hHxrYjoj4j1EfG1iNhv9w9R\nkiS1kz0Z+dgP+BnwGeA1D4aJiAuA2cC5wExgI7AgIsbWNLsCOB04CzgBmAzcOOijvg1MA07K254A\nXLMH9UqSpDYSw3mwXES8ApyZUrqlZtsa4EsppXn59+OBdcAfp5Suz79/Bjg7pfTdvM3hwDLgmJTS\nooiYBjwMzEgpLc3bnAr8ADg4pbR2j4uWJEmVKnTNR0RMASYBdwxsSym9ACwEjs03HQ3sNajNY8Cq\nmjbHAOsHgkfudrKRlllF1ixJksq1V8GfN4ksIKwbtH1dvg+gB9iSh5J6bSYBT9fuTCltj4jna9rs\nJCIOBE4FVgIv72H9kiSNRHsDbwEWpJSea/UPKzp8VOlU4FtVFyFJUgf7CNmay5YqOnysBYJsdKN2\n9KMHWFrTZmxEjB80+tGT7xtoM/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F1LX9EP+C/cPgd9LKa2q3TeSzolG/VCnfdeeE7swChg3ks6HOkYB43a1\no/LzoerVuMN9kU09bAI+DhxBdsnPc8BvVF1bgcf4JbLLmQ4Ffhe4jWwe7sB8/+fyY/4D4LeBm4DH\ngbE1n3E12VzfiWQLi+4F7q762IZw7PuRDSMeRbbK+n/n37+5yGMH5gM/Bd5FNnz9GPDNqo9/KP2Q\n77uM7B/UQ/N/DH4KLAPGdFk/XA2sJ7vUtKfmtXdNm64/J5r1wwg7J/4m74dDgd8iW8uwDXjPSDkf\nmvVDO54PlXdYQZ3+GWAl2eVT9wNHV11TwcfXR3b58EtkK4+/DUwZ1GYu2SVlm4AFwNRB+8eR3Rfg\nWbKFSP8OHFT1sQ3h2P8H2S/b7YNe/1LksZNdLXAd0E/2j/pXgX2rPv6h9APZ4rJbyf6H9zKwHPgn\nBgXwLumHXfXBduDjRf99aOe+aNYPI+yc+Fp+fC/lx/sf5MFjpJwPzfqhHc8HHywnSZJK1dFrPiRJ\nUucxfEiSpFIZPiRJUqkMH5IkqVSGD0mSVCrDhyRJKpXhQ5IklcrwIUmSSmX4kCRJpTJ8SJKkUhk+\nJElSqf4/o7T2yugZ1LcAAAAASUVORK5CYII=\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7f883bc5fcf8>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.plot(list(list(range(incoming_counts_df.shape[0]))),incoming_counts_df.counts)"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f883bee76a0>"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjQAAAFkCAYAAAA37aFpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzt3X+UXWV97/H3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JIkqfMM\nNJIkqfMMNJIkqfMMNJIkqfP+Pz0zbc7/eN8RAAAAAElFTkSuQmCC\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7f883bebba20>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"incoming_counts_df.counts.plot.hist()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Step 4.3 Looking at Joint Data"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"fly_to_airports = airports[airports.airport_id.isin(routes.route_dest_id)]"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"fly_to_only_airoprts = fly_to_airports[~fly_to_airports.airport_id.isin(routes.route_src_id)]"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"fto_unique = fly_to_only_airoprts.drop_duplicates(subset = 'airport_id')"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"(15, 12)"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fto_unique.shape"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 4.3.1 Combining DataFrames via Merge (also known as Join)"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"m1 = airports.merge(routes,left_on = 'airport_id',right_on = 'route_dest_id')"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>airport_id</th>\n",
" <th>airport_name</th>\n",
" <th>airport_city_main</th>\n",
" <th>airport_country</th>\n",
" <th>airport_faa_code</th>\n",
" <th>airport_icao_code</th>\n",
" <th>airport_x</th>\n",
" <th>airport_y</th>\n",
" <th>airport_alt</th>\n",
" <th>airport_tz_offset</th>\n",
" <th>...</th>\n",
" <th>airport_tz</th>\n",
" <th>route_iata_code</th>\n",
" <th>route_airline_id</th>\n",
" <th>route_src</th>\n",
" <th>route_src_id</th>\n",
" <th>route_dest</th>\n",
" <th>route_dest_id</th>\n",
" <th>route_codeshare</th>\n",
" <th>route_nstops</th>\n",
" <th>route_equip</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>17338</th>\n",
" <td>1463</td>\n",
" <td>Filippos</td>\n",
" <td>Kozani</td>\n",
" <td>Greece</td>\n",
" <td>KZI</td>\n",
" <td>LGKZ</td>\n",
" <td>40.286110</td>\n",
" <td>21.840834</td>\n",
" <td>2059</td>\n",
" <td>2.0</td>\n",
" <td>...</td>\n",
" <td>Europe/Athens</td>\n",
" <td>GQ</td>\n",
" <td>1492</td>\n",
" <td>ATH</td>\n",
" <td>3941</td>\n",
" <td>KZI</td>\n",
" <td>1463</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>J41</td>\n",
" </tr>\n",
" <tr>\n",
" <th>30921</th>\n",
" <td>2680</td>\n",
" <td>Coronel E Carvajal</td>\n",
" <td>Macas</td>\n",
" <td>Ecuador</td>\n",
" <td>XMS</td>\n",
" <td>SEMC</td>\n",
" <td>-2.299167</td>\n",
" <td>-78.120750</td>\n",
" <td>3452</td>\n",
" <td>-5.0</td>\n",
" <td>...</td>\n",
" <td>America/Guayaquil</td>\n",
" <td>EQ</td>\n",
" <td>4863</td>\n",
" <td>UIO</td>\n",
" <td>2688</td>\n",
" <td>XMS</td>\n",
" <td>2680</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>E90</td>\n",
" </tr>\n",
" <tr>\n",
" <th>30960</th>\n",
" <td>2697</td>\n",
" <td>Teniente Coronel Luis A Mantilla</td>\n",
" <td>Tulcan</td>\n",
" <td>Ecuador</td>\n",
" <td>TUA</td>\n",
" <td>SETU</td>\n",
" <td>0.809506</td>\n",
" <td>-77.708056</td>\n",
" <td>9649</td>\n",
" <td>-5.0</td>\n",
" <td>...</td>\n",
" <td>America/Guayaquil</td>\n",
" <td>EQ</td>\n",
" <td>4863</td>\n",
" <td>UIO</td>\n",
" <td>2688</td>\n",
" <td>TUA</td>\n",
" <td>2697</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>E70</td>\n",
" </tr>\n",
" <tr>\n",
" <th>61159</th>\n",
" <td>4125</td>\n",
" <td>Utila Airport</td>\n",
" <td>Utila</td>\n",
" <td>Honduras</td>\n",
" <td>UII</td>\n",
" <td>MHUT</td>\n",
" <td>16.091667</td>\n",
" <td>-86.887500</td>\n",
" <td>10</td>\n",
" <td>-6.0</td>\n",
" <td>...</td>\n",
" <td>America/Tegucigalpa</td>\n",
" <td>P4</td>\n",
" <td>18169</td>\n",
" <td>LCE</td>\n",
" <td>1771</td>\n",
" <td>UII</td>\n",
" <td>4125</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>L4T</td>\n",
" </tr>\n",
" <tr>\n",
" <th>62329</th>\n",
" <td>4336</td>\n",
" <td>Abraham Lincoln Capital</td>\n",
" <td>Springfield</td>\n",
" <td>United States</td>\n",
" <td>SPI</td>\n",
" <td>KSPI</td>\n",
" <td>39.844100</td>\n",
" <td>-89.677889</td>\n",
" <td>597</td>\n",
" <td>-6.0</td>\n",
" <td>...</td>\n",
" <td>America/Chicago</td>\n",
" <td>AA</td>\n",
" <td>24</td>\n",
" <td>DFW</td>\n",
" <td>3670</td>\n",
" <td>SPI</td>\n",
" <td>4336</td>\n",
" <td>Y</td>\n",
" <td>0</td>\n",
" <td>ERD ER4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>62330</th>\n",
" <td>4336</td>\n",
" <td>Abraham Lincoln Capital</td>\n",
" <td>Springfield</td>\n",
" <td>United States</td>\n",
" <td>SPI</td>\n",
" <td>KSPI</td>\n",
" <td>39.844100</td>\n",
" <td>-89.677889</td>\n",
" <td>597</td>\n",
" <td>-6.0</td>\n",
" <td>...</td>\n",
" <td>America/Chicago</td>\n",
" <td>G4</td>\n",
" <td>35</td>\n",
" <td>PGD</td>\n",
" <td>7056</td>\n",
" <td>SPI</td>\n",
" <td>4336</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>M80</td>\n",
" </tr>\n",
" <tr>\n",
" <th>62331</th>\n",
" <td>4336</td>\n",
" <td>Abraham Lincoln Capital</td>\n",
" <td>Springfield</td>\n",
" <td>United States</td>\n",
" <td>SPI</td>\n",
" <td>KSPI</td>\n",
" <td>39.844100</td>\n",
" <td>-89.677889</td>\n",
" <td>597</td>\n",
" <td>-6.0</td>\n",
" <td>...</td>\n",
" <td>America/Chicago</td>\n",
" <td>G4</td>\n",
" <td>35</td>\n",
" <td>SFB</td>\n",
" <td>4167</td>\n",
" <td>SPI</td>\n",
" <td>4336</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>M80</td>\n",
" </tr>\n",
" <tr>\n",
" <th>62332</th>\n",
" <td>4336</td>\n",
" <td>Abraham Lincoln Capital</td>\n",
" <td>Springfield</td>\n",
" <td>United States</td>\n",
" <td>SPI</td>\n",
" <td>KSPI</td>\n",
" <td>39.844100</td>\n",
" <td>-89.677889</td>\n",
" <td>597</td>\n",
" <td>-6.0</td>\n",
" <td>...</td>\n",
" <td>America/Chicago</td>\n",
" <td>UA</td>\n",
" <td>5209</td>\n",
" <td>ORD</td>\n",
" <td>3830</td>\n",
" <td>SPI</td>\n",
" <td>4336</td>\n",
" <td>Y</td>\n",
" <td>0</td>\n",
" <td>CRJ</td>\n",
" </tr>\n",
" <tr>\n",
" <th>62333</th>\n",
" <td>4336</td>\n",
" <td>Abraham Lincoln Capital</td>\n",
" <td>Springfield</td>\n",
" <td>United States</td>\n",
" <td>SPI</td>\n",
" <td>KSPI</td>\n",
" <td>39.844100</td>\n",
" <td>-89.677889</td>\n",
" <td>597</td>\n",
" <td>-6.0</td>\n",
" <td>...</td>\n",
" <td>America/Chicago</td>\n",
" <td>US</td>\n",
" <td>5265</td>\n",
" <td>DFW</td>\n",
" <td>3670</td>\n",
" <td>SPI</td>\n",
" <td>4336</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>ERD ER4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>63468</th>\n",
" <td>5455</td>\n",
" <td>Punta Gorda Airport</td>\n",
" <td>Punta Gorda</td>\n",
" <td>Belize</td>\n",
" <td>PND</td>\n",
" <td></td>\n",
" <td>16.102400</td>\n",
" <td>-88.808300</td>\n",
" <td>7</td>\n",
" <td>-6.0</td>\n",
" <td>...</td>\n",
" <td>America/Belize</td>\n",
" <td>MY</td>\n",
" <td>3498</td>\n",
" <td>PLJ</td>\n",
" <td>7288</td>\n",
" <td>PND</td>\n",
" <td>5455</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>CNC</td>\n",
" </tr>\n",
" <tr>\n",
" <th>64730</th>\n",
" <td>6372</td>\n",
" <td>Dalanzadgad Airport</td>\n",
" <td>Dalanzadgad</td>\n",
" <td>Mongolia</td>\n",
" <td>DLZ</td>\n",
" <td>ZMDZ</td>\n",
" <td>43.591700</td>\n",
" <td>104.430000</td>\n",
" <td>4787</td>\n",
" <td>8.0</td>\n",
" <td>...</td>\n",
" <td>Asia/Ulaanbaatar</td>\n",
" <td>MR</td>\n",
" <td>13335</td>\n",
" <td>ULN</td>\n",
" <td>3380</td>\n",
" <td>DLZ</td>\n",
" <td>6372</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>F50</td>\n",
" </tr>\n",
" <tr>\n",
" <th>65876</th>\n",
" <td>7158</td>\n",
" <td>Pilot Point Airport</td>\n",
" <td>Pilot Point</td>\n",
" <td>United States</td>\n",
" <td>PIP</td>\n",
" <td>PAPN</td>\n",
" <td>57.585393</td>\n",
" <td>-157.571944</td>\n",
" <td>57</td>\n",
" <td>-9.0</td>\n",
" <td>...</td>\n",
" <td>America/Anchorage</td>\n",
" <td>GV</td>\n",
" <td>386</td>\n",
" <td>AKN</td>\n",
" <td>3794</td>\n",
" <td>PIP</td>\n",
" <td>7158</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>BEC</td>\n",
" </tr>\n",
" <tr>\n",
" <th>65879</th>\n",
" <td>7161</td>\n",
" <td>Karuluk Airport</td>\n",
" <td>Karluk</td>\n",
" <td>United States</td>\n",
" <td>KYK</td>\n",
" <td>PAKY</td>\n",
" <td>57.566944</td>\n",
" <td>-154.450278</td>\n",
" <td>137</td>\n",
" <td>-9.0</td>\n",
" <td>...</td>\n",
" <td>America/Anchorage</td>\n",
" <td>2O</td>\n",
" <td>146</td>\n",
" <td>KLN</td>\n",
" <td>7162</td>\n",
" <td>KYK</td>\n",
" <td>7161</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>BNI</td>\n",
" </tr>\n",
" <tr>\n",
" <th>65889</th>\n",
" <td>7172</td>\n",
" <td>Port Williams Seaplane Base</td>\n",
" <td>Port Williams</td>\n",
" <td>United States</td>\n",
" <td>KPR</td>\n",
" <td></td>\n",
" <td>58.490000</td>\n",
" <td>-152.582222</td>\n",
" <td>0</td>\n",
" <td>-9.0</td>\n",
" <td>...</td>\n",
" <td>America/Anchorage</td>\n",
" <td>2O</td>\n",
" <td>146</td>\n",
" <td>SYB</td>\n",
" <td>7173</td>\n",
" <td>KPR</td>\n",
" <td>7172</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>BNI</td>\n",
" </tr>\n",
" <tr>\n",
" <th>65891</th>\n",
" <td>7176</td>\n",
" <td>Zachar Bay Seaplane Base</td>\n",
" <td>Zachar Bay</td>\n",
" <td>United States</td>\n",
" <td>KZB</td>\n",
" <td></td>\n",
" <td>57.550000</td>\n",
" <td>-153.750000</td>\n",
" <td>0</td>\n",
" <td>-9.0</td>\n",
" <td>...</td>\n",
" <td>America/Anchorage</td>\n",
" <td>2O</td>\n",
" <td>146</td>\n",
" <td>AOS</td>\n",
" <td>7167</td>\n",
" <td>KZB</td>\n",
" <td>7176</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>BNI</td>\n",
" </tr>\n",
" <tr>\n",
" <th>66034</th>\n",
" <td>7369</td>\n",
" <td>Campo Alegre Airport</td>\n",
" <td>Santana do Araguaia</td>\n",
" <td>Brazil</td>\n",
" <td>CMP</td>\n",
" <td>SNKE</td>\n",
" <td>-9.505000</td>\n",
" <td>-50.625000</td>\n",
" <td>525</td>\n",
" <td>-4.0</td>\n",
" <td>...</td>\n",
" <td>America/Boa_Vista</td>\n",
" <td>S5</td>\n",
" <td>4822</td>\n",
" <td>CDJ</td>\n",
" <td>2518</td>\n",
" <td>CMP</td>\n",
" <td>7369</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>CNC</td>\n",
" </tr>\n",
" <tr>\n",
" <th>66035</th>\n",
" <td>7370</td>\n",
" <td>Breves Airport</td>\n",
" <td>Breves</td>\n",
" <td>Brazil</td>\n",
" <td>BVS</td>\n",
" <td>SNVS</td>\n",
" <td>-1.681944</td>\n",
" <td>-50.480000</td>\n",
" <td>131</td>\n",
" <td>-4.0</td>\n",
" <td>...</td>\n",
" <td>America/Boa_Vista</td>\n",
" <td>M6</td>\n",
" <td>246</td>\n",
" <td>BEL</td>\n",
" <td>2526</td>\n",
" <td>BVS</td>\n",
" <td>7370</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>EMB</td>\n",
" </tr>\n",
" <tr>\n",
" <th>66242</th>\n",
" <td>7901</td>\n",
" <td>El Porvenir</td>\n",
" <td>El Porvenir</td>\n",
" <td>Panama</td>\n",
" <td>PVE</td>\n",
" <td></td>\n",
" <td>9.559167</td>\n",
" <td>-78.971111</td>\n",
" <td>5</td>\n",
" <td>-5.0</td>\n",
" <td>...</td>\n",
" <td>America/Panama</td>\n",
" <td>7P</td>\n",
" <td>1500</td>\n",
" <td>PAC</td>\n",
" <td>1869</td>\n",
" <td>PVE</td>\n",
" <td>7901</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>DHT</td>\n",
" </tr>\n",
" <tr>\n",
" <th>66351</th>\n",
" <td>8259</td>\n",
" <td>Oriximina Airport</td>\n",
" <td>Oriximina</td>\n",
" <td>Brazil</td>\n",
" <td>ORX</td>\n",
" <td>SNOX</td>\n",
" <td>-1.714167</td>\n",
" <td>-55.836111</td>\n",
" <td>262</td>\n",
" <td>-4.0</td>\n",
" <td>...</td>\n",
" <td>America/Boa_Vista</td>\n",
" <td>M6</td>\n",
" <td>246</td>\n",
" <td>ATM</td>\n",
" <td>2566</td>\n",
" <td>ORX</td>\n",
" <td>8259</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>EM2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>66352</th>\n",
" <td>8259</td>\n",
" <td>Oriximina Airport</td>\n",
" <td>Oriximina</td>\n",
" <td>Brazil</td>\n",
" <td>ORX</td>\n",
" <td>SNOX</td>\n",
" <td>-1.714167</td>\n",
" <td>-55.836111</td>\n",
" <td>262</td>\n",
" <td>-4.0</td>\n",
" <td>...</td>\n",
" <td>America/Boa_Vista</td>\n",
" <td>M6</td>\n",
" <td>246</td>\n",
" <td>STM</td>\n",
" <td>4092</td>\n",
" <td>ORX</td>\n",
" <td>8259</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>EM2</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>20 rows × 21 columns</p>\n",
"</div>"
],
"text/plain": [
" airport_id airport_name airport_city_main \\\n",
"17338 1463 Filippos Kozani \n",
"30921 2680 Coronel E Carvajal Macas \n",
"30960 2697 Teniente Coronel Luis A Mantilla Tulcan \n",
"61159 4125 Utila Airport Utila \n",
"62329 4336 Abraham Lincoln Capital Springfield \n",
"62330 4336 Abraham Lincoln Capital Springfield \n",
"62331 4336 Abraham Lincoln Capital Springfield \n",
"62332 4336 Abraham Lincoln Capital Springfield \n",
"62333 4336 Abraham Lincoln Capital Springfield \n",
"63468 5455 Punta Gorda Airport Punta Gorda \n",
"64730 6372 Dalanzadgad Airport Dalanzadgad \n",
"65876 7158 Pilot Point Airport Pilot Point \n",
"65879 7161 Karuluk Airport Karluk \n",
"65889 7172 Port Williams Seaplane Base Port Williams \n",
"65891 7176 Zachar Bay Seaplane Base Zachar Bay \n",
"66034 7369 Campo Alegre Airport Santana do Araguaia \n",
"66035 7370 Breves Airport Breves \n",
"66242 7901 El Porvenir El Porvenir \n",
"66351 8259 Oriximina Airport Oriximina \n",
"66352 8259 Oriximina Airport Oriximina \n",
"\n",
" airport_country airport_faa_code airport_icao_code airport_x \\\n",
"17338 Greece KZI LGKZ 40.286110 \n",
"30921 Ecuador XMS SEMC -2.299167 \n",
"30960 Ecuador TUA SETU 0.809506 \n",
"61159 Honduras UII MHUT 16.091667 \n",
"62329 United States SPI KSPI 39.844100 \n",
"62330 United States SPI KSPI 39.844100 \n",
"62331 United States SPI KSPI 39.844100 \n",
"62332 United States SPI KSPI 39.844100 \n",
"62333 United States SPI KSPI 39.844100 \n",
"63468 Belize PND 16.102400 \n",
"64730 Mongolia DLZ ZMDZ 43.591700 \n",
"65876 United States PIP PAPN 57.585393 \n",
"65879 United States KYK PAKY 57.566944 \n",
"65889 United States KPR 58.490000 \n",
"65891 United States KZB 57.550000 \n",
"66034 Brazil CMP SNKE -9.505000 \n",
"66035 Brazil BVS SNVS -1.681944 \n",
"66242 Panama PVE 9.559167 \n",
"66351 Brazil ORX SNOX -1.714167 \n",
"66352 Brazil ORX SNOX -1.714167 \n",
"\n",
" airport_y airport_alt airport_tz_offset ... \\\n",
"17338 21.840834 2059 2.0 ... \n",
"30921 -78.120750 3452 -5.0 ... \n",
"30960 -77.708056 9649 -5.0 ... \n",
"61159 -86.887500 10 -6.0 ... \n",
"62329 -89.677889 597 -6.0 ... \n",
"62330 -89.677889 597 -6.0 ... \n",
"62331 -89.677889 597 -6.0 ... \n",
"62332 -89.677889 597 -6.0 ... \n",
"62333 -89.677889 597 -6.0 ... \n",
"63468 -88.808300 7 -6.0 ... \n",
"64730 104.430000 4787 8.0 ... \n",
"65876 -157.571944 57 -9.0 ... \n",
"65879 -154.450278 137 -9.0 ... \n",
"65889 -152.582222 0 -9.0 ... \n",
"65891 -153.750000 0 -9.0 ... \n",
"66034 -50.625000 525 -4.0 ... \n",
"66035 -50.480000 131 -4.0 ... \n",
"66242 -78.971111 5 -5.0 ... \n",
"66351 -55.836111 262 -4.0 ... \n",
"66352 -55.836111 262 -4.0 ... \n",
"\n",
" airport_tz route_iata_code route_airline_id route_src \\\n",
"17338 Europe/Athens GQ 1492 ATH \n",
"30921 America/Guayaquil EQ 4863 UIO \n",
"30960 America/Guayaquil EQ 4863 UIO \n",
"61159 America/Tegucigalpa P4 18169 LCE \n",
"62329 America/Chicago AA 24 DFW \n",
"62330 America/Chicago G4 35 PGD \n",
"62331 America/Chicago G4 35 SFB \n",
"62332 America/Chicago UA 5209 ORD \n",
"62333 America/Chicago US 5265 DFW \n",
"63468 America/Belize MY 3498 PLJ \n",
"64730 Asia/Ulaanbaatar MR 13335 ULN \n",
"65876 America/Anchorage GV 386 AKN \n",
"65879 America/Anchorage 2O 146 KLN \n",
"65889 America/Anchorage 2O 146 SYB \n",
"65891 America/Anchorage 2O 146 AOS \n",
"66034 America/Boa_Vista S5 4822 CDJ \n",
"66035 America/Boa_Vista M6 246 BEL \n",
"66242 America/Panama 7P 1500 PAC \n",
"66351 America/Boa_Vista M6 246 ATM \n",
"66352 America/Boa_Vista M6 246 STM \n",
"\n",
" route_src_id route_dest route_dest_id route_codeshare route_nstops \\\n",
"17338 3941 KZI 1463 0 \n",
"30921 2688 XMS 2680 0 \n",
"30960 2688 TUA 2697 0 \n",
"61159 1771 UII 4125 0 \n",
"62329 3670 SPI 4336 Y 0 \n",
"62330 7056 SPI 4336 0 \n",
"62331 4167 SPI 4336 0 \n",
"62332 3830 SPI 4336 Y 0 \n",
"62333 3670 SPI 4336 0 \n",
"63468 7288 PND 5455 0 \n",
"64730 3380 DLZ 6372 0 \n",
"65876 3794 PIP 7158 0 \n",
"65879 7162 KYK 7161 0 \n",
"65889 7173 KPR 7172 0 \n",
"65891 7167 KZB 7176 0 \n",
"66034 2518 CMP 7369 0 \n",
"66035 2526 BVS 7370 0 \n",
"66242 1869 PVE 7901 0 \n",
"66351 2566 ORX 8259 0 \n",
"66352 4092 ORX 8259 0 \n",
"\n",
" route_equip \n",
"17338 J41 \n",
"30921 E90 \n",
"30960 E70 \n",
"61159 L4T \n",
"62329 ERD ER4 \n",
"62330 M80 \n",
"62331 M80 \n",
"62332 CRJ \n",
"62333 ERD ER4 \n",
"63468 CNC \n",
"64730 F50 \n",
"65876 BEC \n",
"65879 BNI \n",
"65889 BNI \n",
"65891 BNI \n",
"66034 CNC \n",
"66035 EMB \n",
"66242 DHT \n",
"66351 EM2 \n",
"66352 EM2 \n",
"\n",
"[20 rows x 21 columns]"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"m1[~m1.airport_id.isin(m1.route_src_id)]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 4.3.2 Top-k Destinations"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"incoming_counts_df=incoming_counts_df.sort_values('counts',ascending = False)"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>counts</th>\n",
" <th>airport_id</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>905</td>\n",
" <td>3682</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>550</td>\n",
" <td>3830</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>526</td>\n",
" <td>3364</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>524</td>\n",
" <td>507</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>517</td>\n",
" <td>1382</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>497</td>\n",
" <td>3484</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>493</td>\n",
" <td>340</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>467</td>\n",
" <td>3670</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>455</td>\n",
" <td>3797</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>450</td>\n",
" <td>580</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" counts airport_id\n",
"0 905 3682\n",
"1 550 3830\n",
"2 526 3364\n",
"3 524 507\n",
"4 517 1382\n",
"5 497 3484\n",
"6 493 340\n",
"7 467 3670\n",
"8 455 3797\n",
"9 450 580"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"top10cnt = incoming_counts_df.iloc[0:10]\n",
"top10cnt"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>counts</th>\n",
" <th>airport_id</th>\n",
" <th>airport_name</th>\n",
" <th>airport_city_main</th>\n",
" <th>airport_country</th>\n",
" <th>airport_faa_code</th>\n",
" <th>airport_icao_code</th>\n",
" <th>airport_x</th>\n",
" <th>airport_y</th>\n",
" <th>airport_alt</th>\n",
" <th>airport_tz_offset</th>\n",
" <th>airport_dst</th>\n",
" <th>airport_tz</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>905</td>\n",
" <td>3682</td>\n",
" <td>Hartsfield Jackson Atlanta Intl</td>\n",
" <td>Atlanta</td>\n",
" <td>United States</td>\n",
" <td>ATL</td>\n",
" <td>KATL</td>\n",
" <td>33.636719</td>\n",
" <td>-84.428067</td>\n",
" <td>1026</td>\n",
" <td>-5.0</td>\n",
" <td>A</td>\n",
" <td>America/New_York</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>550</td>\n",
" <td>3830</td>\n",
" <td>Chicago Ohare Intl</td>\n",
" <td>Chicago</td>\n",
" <td>United States</td>\n",
" <td>ORD</td>\n",
" <td>KORD</td>\n",
" <td>41.978603</td>\n",
" <td>-87.904842</td>\n",
" <td>668</td>\n",
" <td>-6.0</td>\n",
" <td>A</td>\n",
" <td>America/Chicago</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>526</td>\n",
" <td>3364</td>\n",
" <td>Capital Intl</td>\n",
" <td>Beijing</td>\n",
" <td>China</td>\n",
" <td>PEK</td>\n",
" <td>ZBAA</td>\n",
" <td>40.080111</td>\n",
" <td>116.584556</td>\n",
" <td>116</td>\n",
" <td>8.0</td>\n",
" <td>U</td>\n",
" <td>Asia/Chongqing</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>524</td>\n",
" <td>507</td>\n",
" <td>Heathrow</td>\n",
" <td>London</td>\n",
" <td>United Kingdom</td>\n",
" <td>LHR</td>\n",
" <td>EGLL</td>\n",
" <td>51.477500</td>\n",
" <td>-0.461389</td>\n",
" <td>83</td>\n",
" <td>0.0</td>\n",
" <td>E</td>\n",
" <td>Europe/London</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>517</td>\n",
" <td>1382</td>\n",
" <td>Charles De Gaulle</td>\n",
" <td>Paris</td>\n",
" <td>France</td>\n",
" <td>CDG</td>\n",
" <td>LFPG</td>\n",
" <td>49.012779</td>\n",
" <td>2.550000</td>\n",
" <td>392</td>\n",
" <td>1.0</td>\n",
" <td>E</td>\n",
" <td>Europe/Paris</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>497</td>\n",
" <td>3484</td>\n",
" <td>Los Angeles Intl</td>\n",
" <td>Los Angeles</td>\n",
" <td>United States</td>\n",
" <td>LAX</td>\n",
" <td>KLAX</td>\n",
" <td>33.942536</td>\n",
" <td>-118.408075</td>\n",
" <td>126</td>\n",
" <td>-8.0</td>\n",
" <td>A</td>\n",
" <td>America/Los_Angeles</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>493</td>\n",
" <td>340</td>\n",
" <td>Frankfurt Main</td>\n",
" <td>Frankfurt</td>\n",
" <td>Germany</td>\n",
" <td>FRA</td>\n",
" <td>EDDF</td>\n",
" <td>50.026421</td>\n",
" <td>8.543125</td>\n",
" <td>364</td>\n",
" <td>1.0</td>\n",
" <td>E</td>\n",
" <td>Europe/Berlin</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>467</td>\n",
" <td>3670</td>\n",
" <td>Dallas Fort Worth Intl</td>\n",
" <td>Dallas-Fort Worth</td>\n",
" <td>United States</td>\n",
" <td>DFW</td>\n",
" <td>KDFW</td>\n",
" <td>32.896828</td>\n",
" <td>-97.037997</td>\n",
" <td>607</td>\n",
" <td>-6.0</td>\n",
" <td>A</td>\n",
" <td>America/Chicago</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>455</td>\n",
" <td>3797</td>\n",
" <td>John F Kennedy Intl</td>\n",
" <td>New York</td>\n",
" <td>United States</td>\n",
" <td>JFK</td>\n",
" <td>KJFK</td>\n",
" <td>40.639751</td>\n",
" <td>-73.778925</td>\n",
" <td>13</td>\n",
" <td>-5.0</td>\n",
" <td>A</td>\n",
" <td>America/New_York</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>450</td>\n",
" <td>580</td>\n",
" <td>Schiphol</td>\n",
" <td>Amsterdam</td>\n",
" <td>Netherlands</td>\n",
" <td>AMS</td>\n",
" <td>EHAM</td>\n",
" <td>52.308613</td>\n",
" <td>4.763889</td>\n",
" <td>-11</td>\n",
" <td>1.0</td>\n",
" <td>E</td>\n",
" <td>Europe/Amsterdam</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" counts airport_id airport_name airport_city_main \\\n",
"0 905 3682 Hartsfield Jackson Atlanta Intl Atlanta \n",
"1 550 3830 Chicago Ohare Intl Chicago \n",
"2 526 3364 Capital Intl Beijing \n",
"3 524 507 Heathrow London \n",
"4 517 1382 Charles De Gaulle Paris \n",
"5 497 3484 Los Angeles Intl Los Angeles \n",
"6 493 340 Frankfurt Main Frankfurt \n",
"7 467 3670 Dallas Fort Worth Intl Dallas-Fort Worth \n",
"8 455 3797 John F Kennedy Intl New York \n",
"9 450 580 Schiphol Amsterdam \n",
"\n",
" airport_country airport_faa_code airport_icao_code airport_x airport_y \\\n",
"0 United States ATL KATL 33.636719 -84.428067 \n",
"1 United States ORD KORD 41.978603 -87.904842 \n",
"2 China PEK ZBAA 40.080111 116.584556 \n",
"3 United Kingdom LHR EGLL 51.477500 -0.461389 \n",
"4 France CDG LFPG 49.012779 2.550000 \n",
"5 United States LAX KLAX 33.942536 -118.408075 \n",
"6 Germany FRA EDDF 50.026421 8.543125 \n",
"7 United States DFW KDFW 32.896828 -97.037997 \n",
"8 United States JFK KJFK 40.639751 -73.778925 \n",
"9 Netherlands AMS EHAM 52.308613 4.763889 \n",
"\n",
" airport_alt airport_tz_offset airport_dst airport_tz \n",
"0 1026 -5.0 A America/New_York \n",
"1 668 -6.0 A America/Chicago \n",
"2 116 8.0 U Asia/Chongqing \n",
"3 83 0.0 E Europe/London \n",
"4 392 1.0 E Europe/Paris \n",
"5 126 -8.0 A America/Los_Angeles \n",
"6 364 1.0 E Europe/Berlin \n",
"7 607 -6.0 A America/Chicago \n",
"8 13 -5.0 A America/New_York \n",
"9 -11 1.0 E Europe/Amsterdam "
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pd.merge(top10cnt,airports,how = 'inner',on = 'airport_id')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Step 5: Integrating Data\n",
"\n",
"### 5.1 Relating Routes and Flights: Schema Matching\n"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"perf = pd.read_sql_query('SELECT * FROM performance ORDER BY RANDOM() LIMIT 1000',con = engine)"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Year</th>\n",
" <th>Month</th>\n",
" <th>DayofMonth</th>\n",
" <th>AirlineID</th>\n",
" <th>Carrier</th>\n",
" <th>FlightNum</th>\n",
" <th>Origin</th>\n",
" <th>Dest</th>\n",
" <th>ArrDelayMinutes</th>\n",
" <th>Cancelled</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>9</td>\n",
" <td>20304</td>\n",
" <td>OO</td>\n",
" <td>5190</td>\n",
" <td>SAN</td>\n",
" <td>LAX</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>20</td>\n",
" <td>19805</td>\n",
" <td>AA</td>\n",
" <td>636</td>\n",
" <td>STL</td>\n",
" <td>PHX</td>\n",
" <td>16.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>19</td>\n",
" <td>19790</td>\n",
" <td>DL</td>\n",
" <td>558</td>\n",
" <td>BNA</td>\n",
" <td>ATL</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>18</td>\n",
" <td>19393</td>\n",
" <td>WN</td>\n",
" <td>3663</td>\n",
" <td>LAS</td>\n",
" <td>SLC</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>4</td>\n",
" <td>20304</td>\n",
" <td>OO</td>\n",
" <td>5428</td>\n",
" <td>MKE</td>\n",
" <td>ORD</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>10</td>\n",
" <td>20409</td>\n",
" <td>B6</td>\n",
" <td>459</td>\n",
" <td>BOS</td>\n",
" <td>PHL</td>\n",
" <td>5.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>28</td>\n",
" <td>20416</td>\n",
" <td>NK</td>\n",
" <td>111</td>\n",
" <td>DTW</td>\n",
" <td>LAS</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>9</td>\n",
" <td>19393</td>\n",
" <td>WN</td>\n",
" <td>2506</td>\n",
" <td>STL</td>\n",
" <td>PHX</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>10</td>\n",
" <td>19790</td>\n",
" <td>DL</td>\n",
" <td>2016</td>\n",
" <td>SAN</td>\n",
" <td>DTW</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>19</td>\n",
" <td>19977</td>\n",
" <td>UA</td>\n",
" <td>1922</td>\n",
" <td>EWR</td>\n",
" <td>BOS</td>\n",
" <td>22.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>27</td>\n",
" <td>20366</td>\n",
" <td>EV</td>\n",
" <td>4183</td>\n",
" <td>BNA</td>\n",
" <td>IAH</td>\n",
" <td>21.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>23</td>\n",
" <td>19393</td>\n",
" <td>WN</td>\n",
" <td>588</td>\n",
" <td>DEN</td>\n",
" <td>SNA</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>26</td>\n",
" <td>19790</td>\n",
" <td>DL</td>\n",
" <td>1495</td>\n",
" <td>DTW</td>\n",
" <td>BDL</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>12</td>\n",
" <td>19393</td>\n",
" <td>WN</td>\n",
" <td>1492</td>\n",
" <td>SEA</td>\n",
" <td>SMF</td>\n",
" <td>20.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>5</td>\n",
" <td>19805</td>\n",
" <td>AA</td>\n",
" <td>483</td>\n",
" <td>GEG</td>\n",
" <td>PHX</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>5</td>\n",
" <td>19977</td>\n",
" <td>UA</td>\n",
" <td>548</td>\n",
" <td>LAS</td>\n",
" <td>EWR</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>5</td>\n",
" <td>19805</td>\n",
" <td>AA</td>\n",
" <td>2220</td>\n",
" <td>ORD</td>\n",
" <td>LAX</td>\n",
" <td>30.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>25</td>\n",
" <td>19977</td>\n",
" <td>UA</td>\n",
" <td>2001</td>\n",
" <td>ORD</td>\n",
" <td>LAX</td>\n",
" <td>31.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>14</td>\n",
" <td>19805</td>\n",
" <td>AA</td>\n",
" <td>1537</td>\n",
" <td>EWR</td>\n",
" <td>DFW</td>\n",
" <td>4.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>17</td>\n",
" <td>19790</td>\n",
" <td>DL</td>\n",
" <td>1524</td>\n",
" <td>SLC</td>\n",
" <td>ATL</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>5</td>\n",
" <td>19790</td>\n",
" <td>DL</td>\n",
" <td>455</td>\n",
" <td>JFK</td>\n",
" <td>SLC</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>30</td>\n",
" <td>19977</td>\n",
" <td>UA</td>\n",
" <td>548</td>\n",
" <td>LAS</td>\n",
" <td>EWR</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>2</td>\n",
" <td>19790</td>\n",
" <td>DL</td>\n",
" <td>2344</td>\n",
" <td>JFK</td>\n",
" <td>CHS</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>16</td>\n",
" <td>19930</td>\n",
" <td>AS</td>\n",
" <td>621</td>\n",
" <td>LAS</td>\n",
" <td>PDX</td>\n",
" <td>2.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>24</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>1</td>\n",
" <td>19790</td>\n",
" <td>DL</td>\n",
" <td>1238</td>\n",
" <td>PHX</td>\n",
" <td>ATL</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>2</td>\n",
" <td>20409</td>\n",
" <td>B6</td>\n",
" <td>803</td>\n",
" <td>JFK</td>\n",
" <td>SJU</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>20</td>\n",
" <td>19805</td>\n",
" <td>AA</td>\n",
" <td>327</td>\n",
" <td>DCA</td>\n",
" <td>DFW</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>23</td>\n",
" <td>20416</td>\n",
" <td>NK</td>\n",
" <td>948</td>\n",
" <td>DFW</td>\n",
" <td>ORD</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>28</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>22</td>\n",
" <td>19805</td>\n",
" <td>AA</td>\n",
" <td>1925</td>\n",
" <td>JAX</td>\n",
" <td>CLT</td>\n",
" <td>3.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>29</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>30</td>\n",
" <td>20304</td>\n",
" <td>OO</td>\n",
" <td>3390</td>\n",
" <td>SEA</td>\n",
" <td>SBA</td>\n",
" <td>25.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>970</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>30</td>\n",
" <td>19393</td>\n",
" <td>WN</td>\n",
" <td>4117</td>\n",
" <td>CMH</td>\n",
" <td>ATL</td>\n",
" <td>2.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>971</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>2</td>\n",
" <td>19930</td>\n",
" <td>AS</td>\n",
" <td>73</td>\n",
" <td>JNU</td>\n",
" <td>ANC</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>972</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>21</td>\n",
" <td>19393</td>\n",
" <td>WN</td>\n",
" <td>2622</td>\n",
" <td>SJC</td>\n",
" <td>MDW</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>973</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>27</td>\n",
" <td>19930</td>\n",
" <td>AS</td>\n",
" <td>644</td>\n",
" <td>PDX</td>\n",
" <td>PHX</td>\n",
" <td>2.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>974</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>23</td>\n",
" <td>19805</td>\n",
" <td>AA</td>\n",
" <td>1319</td>\n",
" <td>PHX</td>\n",
" <td>JFK</td>\n",
" <td>29.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>975</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>12</td>\n",
" <td>19977</td>\n",
" <td>UA</td>\n",
" <td>396</td>\n",
" <td>HNL</td>\n",
" <td>SFO</td>\n",
" <td>308.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>976</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>4</td>\n",
" <td>20304</td>\n",
" <td>OO</td>\n",
" <td>5237</td>\n",
" <td>ORD</td>\n",
" <td>RAP</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>977</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>25</td>\n",
" <td>20304</td>\n",
" <td>OO</td>\n",
" <td>4773</td>\n",
" <td>SLC</td>\n",
" <td>PSC</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>978</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>3</td>\n",
" <td>19393</td>\n",
" <td>WN</td>\n",
" <td>502</td>\n",
" <td>BNA</td>\n",
" <td>STL</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>979</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>10</td>\n",
" <td>19393</td>\n",
" <td>WN</td>\n",
" <td>206</td>\n",
" <td>BWI</td>\n",
" <td>CLT</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>980</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>1</td>\n",
" <td>19805</td>\n",
" <td>AA</td>\n",
" <td>338</td>\n",
" <td>ORD</td>\n",
" <td>LGA</td>\n",
" <td>3.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>981</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>18</td>\n",
" <td>19805</td>\n",
" <td>AA</td>\n",
" <td>2665</td>\n",
" <td>TUL</td>\n",
" <td>DFW</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>982</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>2</td>\n",
" <td>19805</td>\n",
" <td>AA</td>\n",
" <td>2190</td>\n",
" <td>STL</td>\n",
" <td>DFW</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>983</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>25</td>\n",
" <td>19790</td>\n",
" <td>DL</td>\n",
" <td>1636</td>\n",
" <td>PSC</td>\n",
" <td>SLC</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>984</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>1</td>\n",
" <td>19805</td>\n",
" <td>AA</td>\n",
" <td>2502</td>\n",
" <td>DFW</td>\n",
" <td>SNA</td>\n",
" <td>11.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>985</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>27</td>\n",
" <td>19790</td>\n",
" <td>DL</td>\n",
" <td>2694</td>\n",
" <td>LGA</td>\n",
" <td>BOS</td>\n",
" <td>58.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>986</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>18</td>\n",
" <td>19805</td>\n",
" <td>AA</td>\n",
" <td>2313</td>\n",
" <td>DFW</td>\n",
" <td>MFE</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>987</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>8</td>\n",
" <td>19977</td>\n",
" <td>UA</td>\n",
" <td>1590</td>\n",
" <td>SAN</td>\n",
" <td>IAD</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>988</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>27</td>\n",
" <td>19393</td>\n",
" <td>WN</td>\n",
" <td>462</td>\n",
" <td>BUR</td>\n",
" <td>PHX</td>\n",
" <td>27.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>989</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>27</td>\n",
" <td>20304</td>\n",
" <td>OO</td>\n",
" <td>4579</td>\n",
" <td>MDT</td>\n",
" <td>DTW</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>990</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>14</td>\n",
" <td>19977</td>\n",
" <td>UA</td>\n",
" <td>750</td>\n",
" <td>LAX</td>\n",
" <td>DEN</td>\n",
" <td>45.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>991</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>21</td>\n",
" <td>19790</td>\n",
" <td>DL</td>\n",
" <td>1099</td>\n",
" <td>MSP</td>\n",
" <td>ANC</td>\n",
" <td>8.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>992</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>19</td>\n",
" <td>20304</td>\n",
" <td>OO</td>\n",
" <td>4768</td>\n",
" <td>GEG</td>\n",
" <td>SEA</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>993</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>5</td>\n",
" <td>19805</td>\n",
" <td>AA</td>\n",
" <td>577</td>\n",
" <td>PHL</td>\n",
" <td>LAS</td>\n",
" <td>20.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>994</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>17</td>\n",
" <td>19790</td>\n",
" <td>DL</td>\n",
" <td>2442</td>\n",
" <td>VPS</td>\n",
" <td>ATL</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>995</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>4</td>\n",
" <td>20409</td>\n",
" <td>B6</td>\n",
" <td>1434</td>\n",
" <td>SJU</td>\n",
" <td>MCO</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>996</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>21</td>\n",
" <td>19977</td>\n",
" <td>UA</td>\n",
" <td>362</td>\n",
" <td>SFO</td>\n",
" <td>PHX</td>\n",
" <td>61.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>997</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>18</td>\n",
" <td>19393</td>\n",
" <td>WN</td>\n",
" <td>3199</td>\n",
" <td>BNA</td>\n",
" <td>DCA</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>998</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>25</td>\n",
" <td>19790</td>\n",
" <td>DL</td>\n",
" <td>997</td>\n",
" <td>JAX</td>\n",
" <td>ATL</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>999</th>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>25</td>\n",
" <td>19977</td>\n",
" <td>UA</td>\n",
" <td>1218</td>\n",
" <td>ORD</td>\n",
" <td>IAH</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>1000 rows × 10 columns</p>\n",
"</div>"
],
"text/plain": [
" Year Month DayofMonth AirlineID Carrier FlightNum Origin Dest \\\n",
"0 2016 10 9 20304 OO 5190 SAN LAX \n",
"1 2016 10 20 19805 AA 636 STL PHX \n",
"2 2016 10 19 19790 DL 558 BNA ATL \n",
"3 2016 10 18 19393 WN 3663 LAS SLC \n",
"4 2016 10 4 20304 OO 5428 MKE ORD \n",
"5 2016 10 10 20409 B6 459 BOS PHL \n",
"6 2016 10 28 20416 NK 111 DTW LAS \n",
"7 2016 10 9 19393 WN 2506 STL PHX \n",
"8 2016 10 10 19790 DL 2016 SAN DTW \n",
"9 2016 10 19 19977 UA 1922 EWR BOS \n",
"10 2016 10 27 20366 EV 4183 BNA IAH \n",
"11 2016 10 23 19393 WN 588 DEN SNA \n",
"12 2016 10 26 19790 DL 1495 DTW BDL \n",
"13 2016 10 12 19393 WN 1492 SEA SMF \n",
"14 2016 10 5 19805 AA 483 GEG PHX \n",
"15 2016 10 5 19977 UA 548 LAS EWR \n",
"16 2016 10 5 19805 AA 2220 ORD LAX \n",
"17 2016 10 25 19977 UA 2001 ORD LAX \n",
"18 2016 10 14 19805 AA 1537 EWR DFW \n",
"19 2016 10 17 19790 DL 1524 SLC ATL \n",
"20 2016 10 5 19790 DL 455 JFK SLC \n",
"21 2016 10 30 19977 UA 548 LAS EWR \n",
"22 2016 10 2 19790 DL 2344 JFK CHS \n",
"23 2016 10 16 19930 AS 621 LAS PDX \n",
"24 2016 10 1 19790 DL 1238 PHX ATL \n",
"25 2016 10 2 20409 B6 803 JFK SJU \n",
"26 2016 10 20 19805 AA 327 DCA DFW \n",
"27 2016 10 23 20416 NK 948 DFW ORD \n",
"28 2016 10 22 19805 AA 1925 JAX CLT \n",
"29 2016 10 30 20304 OO 3390 SEA SBA \n",
".. ... ... ... ... ... ... ... ... \n",
"970 2016 10 30 19393 WN 4117 CMH ATL \n",
"971 2016 10 2 19930 AS 73 JNU ANC \n",
"972 2016 10 21 19393 WN 2622 SJC MDW \n",
"973 2016 10 27 19930 AS 644 PDX PHX \n",
"974 2016 10 23 19805 AA 1319 PHX JFK \n",
"975 2016 10 12 19977 UA 396 HNL SFO \n",
"976 2016 10 4 20304 OO 5237 ORD RAP \n",
"977 2016 10 25 20304 OO 4773 SLC PSC \n",
"978 2016 10 3 19393 WN 502 BNA STL \n",
"979 2016 10 10 19393 WN 206 BWI CLT \n",
"980 2016 10 1 19805 AA 338 ORD LGA \n",
"981 2016 10 18 19805 AA 2665 TUL DFW \n",
"982 2016 10 2 19805 AA 2190 STL DFW \n",
"983 2016 10 25 19790 DL 1636 PSC SLC \n",
"984 2016 10 1 19805 AA 2502 DFW SNA \n",
"985 2016 10 27 19790 DL 2694 LGA BOS \n",
"986 2016 10 18 19805 AA 2313 DFW MFE \n",
"987 2016 10 8 19977 UA 1590 SAN IAD \n",
"988 2016 10 27 19393 WN 462 BUR PHX \n",
"989 2016 10 27 20304 OO 4579 MDT DTW \n",
"990 2016 10 14 19977 UA 750 LAX DEN \n",
"991 2016 10 21 19790 DL 1099 MSP ANC \n",
"992 2016 10 19 20304 OO 4768 GEG SEA \n",
"993 2016 10 5 19805 AA 577 PHL LAS \n",
"994 2016 10 17 19790 DL 2442 VPS ATL \n",
"995 2016 10 4 20409 B6 1434 SJU MCO \n",
"996 2016 10 21 19977 UA 362 SFO PHX \n",
"997 2016 10 18 19393 WN 3199 BNA DCA \n",
"998 2016 10 25 19790 DL 997 JAX ATL \n",
"999 2016 10 25 19977 UA 1218 ORD IAH \n",
"\n",
" ArrDelayMinutes Cancelled \n",
"0 0.0 0.0 \n",
"1 16.0 0.0 \n",
"2 0.0 0.0 \n",
"3 0.0 0.0 \n",
"4 0.0 0.0 \n",
"5 5.0 0.0 \n",
"6 0.0 0.0 \n",
"7 0.0 0.0 \n",
"8 0.0 0.0 \n",
"9 22.0 0.0 \n",
"10 21.0 0.0 \n",
"11 0.0 0.0 \n",
"12 0.0 0.0 \n",
"13 20.0 0.0 \n",
"14 0.0 0.0 \n",
"15 0.0 0.0 \n",
"16 30.0 0.0 \n",
"17 31.0 0.0 \n",
"18 4.0 0.0 \n",
"19 0.0 0.0 \n",
"20 0.0 0.0 \n",
"21 0.0 0.0 \n",
"22 0.0 0.0 \n",
"23 2.0 0.0 \n",
"24 0.0 0.0 \n",
"25 0.0 0.0 \n",
"26 0.0 0.0 \n",
"27 0.0 0.0 \n",
"28 3.0 0.0 \n",
"29 25.0 0.0 \n",
".. ... ... \n",
"970 2.0 0.0 \n",
"971 0.0 0.0 \n",
"972 0.0 0.0 \n",
"973 2.0 0.0 \n",
"974 29.0 0.0 \n",
"975 308.0 0.0 \n",
"976 0.0 0.0 \n",
"977 0.0 0.0 \n",
"978 0.0 0.0 \n",
"979 0.0 0.0 \n",
"980 3.0 0.0 \n",
"981 0.0 0.0 \n",
"982 0.0 0.0 \n",
"983 0.0 0.0 \n",
"984 11.0 0.0 \n",
"985 58.0 0.0 \n",
"986 0.0 0.0 \n",
"987 0.0 0.0 \n",
"988 27.0 0.0 \n",
"989 0.0 0.0 \n",
"990 45.0 0.0 \n",
"991 8.0 0.0 \n",
"992 0.0 0.0 \n",
"993 20.0 0.0 \n",
"994 0.0 0.0 \n",
"995 0.0 0.0 \n",
"996 61.0 0.0 \n",
"997 0.0 0.0 \n",
"998 0.0 0.0 \n",
"999 0.0 0.0 \n",
"\n",
"[1000 rows x 10 columns]"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"perf"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"source": [
"### 5.1.1 Column Matches (Schema Matches)"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"jaccard_dict={}\n",
"for c1 in routes.columns:\n",
" jaccard_dict[c1] = {}\n",
" for c2 in perf.columns:\n",
" jd = len(list(set(routes[c1]).intersection(set(perf[c2]))))/len(list(set(routes[c1]).union(set(perf[c2]))))\n",
" if(jd>0):\n",
" jaccard_dict[c1][c2] = jd"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"{'route_airline_id': {'ArrDelayMinutes': 0.01951219512195122,\n",
" 'DayofMonth': 0.0088339222614841,\n",
" 'FlightNum': 0.052980132450331126,\n",
" 'Month': 0.001851851851851852},\n",
" 'route_codeshare': {},\n",
" 'route_dest': {'Dest': 0.04889589905362776, 'Origin': 0.04569807752915222},\n",
" 'route_dest_id': {'ArrDelayMinutes': 0.013694366635543105,\n",
" 'Cancelled': 0.000315357931251971,\n",
" 'DayofMonth': 0.006603773584905661,\n",
" 'FlightNum': 0.10593681917211328,\n",
" 'Month': 0.0003154574132492114},\n",
" 'route_equip': {},\n",
" 'route_iata_code': {'Carrier': 0.01845018450184502},\n",
" 'route_nstops': {'ArrDelayMinutes': 0.022988505747126436,\n",
" 'Cancelled': 1.0,\n",
" 'DayofMonth': 0.03125},\n",
" 'route_src': {'Dest': 0.048942216608778025, 'Origin': 0.04574132492113565},\n",
" 'route_src_id': {'ArrDelayMinutes': 0.013707165109034268,\n",
" 'Cancelled': 0.0003156565656565657,\n",
" 'DayofMonth': 0.0066100094428706326,\n",
" 'FlightNum': 0.10632497273718648,\n",
" 'Month': 0.00031575623618566466}}"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"jaccard_dict"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Step 5.2 Creating Detailed Flights, Filtered by OpenFlight Routes"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"m2 = routes.merge(perf, left_on = ['route_dest','route_src'],right_on = ['Dest','Origin'])"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"m2 = m2.drop_duplicates(subset = 'route_iata_code')"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"Index(['airline_id', 'airline_name', 'airline_alias', 'airline_iata2_code',\n",
" 'airline_icao3_code', 'airline_callsign', 'airline_country',\n",
" 'airline_active'],\n",
" dtype='object')"
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"airlines.columns"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"Index(['route_iata_code', 'route_airline_id', 'route_src', 'route_src_id',\n",
" 'route_dest', 'route_dest_id', 'route_codeshare', 'route_nstops',\n",
" 'route_equip'],\n",
" dtype='object')"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"routes.columns"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"Index(['Year', 'Month', 'DayofMonth', 'AirlineID', 'Carrier', 'FlightNum',\n",
" 'Origin', 'Dest', 'ArrDelayMinutes', 'Cancelled'],\n",
" dtype='object')"
]
},
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"perf.columns"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"airline_iata = airlines.ix[:,['airline_iata2_code']]"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"airline_iata = airline_iata[airline_iata.airline_iata2_code != ''].merge(airline_iata[airline_iata.airline_iata2_code != '-'],on = 'airline_iata2_code')"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"dest_iata = routes.ix[:,['route_dest']].drop_duplicates()"
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"(1088, 1)"
]
},
"execution_count": 51,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"airline_iata = airline_iata.drop_duplicates()\n",
"airline_iata.shape"
]
},
{
"cell_type": "code",
"execution_count": 52,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"(3170, 1)"
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dest_iata.shape"
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"def df_crossjoin(df1, df2, **kwargs):\n",
" df1['_tmpkey'] = 1\n",
" df2['_tmpkey'] = 1\n",
"\n",
" res = pd.merge(df1, df2, on='_tmpkey', **kwargs).drop('_tmpkey', axis=1)\n",
" #res.index = pd.MultiIndex.from_product((df1.index, df2.index))\n",
"\n",
" df1.drop('_tmpkey', axis=1, inplace=True)\n",
" df2.drop('_tmpkey', axis=1, inplace=True)\n",
"\n",
" return res"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"airline_dest = df_crossjoin(airline_iata, dest_iata)"
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"airline_dest_full = airline_dest.merge(m2,left_on=['airline_iata2_code','route_dest'],right_on = ['Carrier','route_dest'])"
]
},
{
"cell_type": "code",
"execution_count": 56,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"airline_dest_full=airline_dest_full.ix[:,['airline_iata2_code','route_dest']]"
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"airline_dest_full['airline_dest'] = list(zip(airline_dest_full.airline_iata2_code, airline_dest_full.route_dest))"
]
},
{
"cell_type": "code",
"execution_count": 58,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"flights_count_series = airline_dest_full.drop(['airline_iata2_code','route_dest'],axis = 1).airline_dest.value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 59,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>airline_dest</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>(B6, JFK)</th>\n",
" <td>6</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(OO, EVV)</th>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(DL, ATL)</th>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(UA, ORD)</th>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(AA, ATL)</th>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(WN, PHX)</th>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(HA, OGG)</th>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(DL, SFO)</th>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(B6, SJU)</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(DL, XNA)</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(AA, PHX)</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(AA, BWI)</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(WN, DEN)</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(WN, ATL)</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(WN, LAS)</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(UA, DFW)</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(OO, ATL)</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(UA, MSY)</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(DL, MSP)</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(AA, LAX)</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(DL, MSY)</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(DL, IAD)</th>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(UA, SFO)</th>\n",
" <td>1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" airline_dest\n",
"(B6, JFK) 6\n",
"(OO, EVV) 4\n",
"(DL, ATL) 4\n",
"(UA, ORD) 3\n",
"(AA, ATL) 2\n",
"(WN, PHX) 2\n",
"(HA, OGG) 2\n",
"(DL, SFO) 2\n",
"(B6, SJU) 1\n",
"(DL, XNA) 1\n",
"(AA, PHX) 1\n",
"(AA, BWI) 1\n",
"(WN, DEN) 1\n",
"(WN, ATL) 1\n",
"(WN, LAS) 1\n",
"(UA, DFW) 1\n",
"(OO, ATL) 1\n",
"(UA, MSY) 1\n",
"(DL, MSP) 1\n",
"(AA, LAX) 1\n",
"(DL, MSY) 1\n",
"(DL, IAD) 1\n",
"(UA, SFO) 1"
]
},
"execution_count": 59,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"flights_count_df=flights_count_series.to_frame()\n",
"flights_count_df"
]
},
{
"cell_type": "code",
"execution_count": 60,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"flights_count_df['airlineXdest']=flights_count_df.index"
]
},
{
"cell_type": "code",
"execution_count": 61,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"clean_flights_count=flights_count_df.reset_index().drop(['index'],axis = 1)"
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>counts</th>\n",
" <th>airlineXdest</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>6</td>\n",
" <td>(B6, JFK)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>4</td>\n",
" <td>(OO, EVV)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>4</td>\n",
" <td>(DL, ATL)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>3</td>\n",
" <td>(UA, ORD)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>2</td>\n",
" <td>(AA, ATL)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>2</td>\n",
" <td>(WN, PHX)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>2</td>\n",
" <td>(HA, OGG)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>2</td>\n",
" <td>(DL, SFO)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>1</td>\n",
" <td>(B6, SJU)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>1</td>\n",
" <td>(DL, XNA)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>1</td>\n",
" <td>(AA, PHX)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>1</td>\n",
" <td>(AA, BWI)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>1</td>\n",
" <td>(WN, DEN)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>1</td>\n",
" <td>(WN, ATL)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>1</td>\n",
" <td>(WN, LAS)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>1</td>\n",
" <td>(UA, DFW)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>1</td>\n",
" <td>(OO, ATL)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>1</td>\n",
" <td>(UA, MSY)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>1</td>\n",
" <td>(DL, MSP)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>1</td>\n",
" <td>(AA, LAX)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>1</td>\n",
" <td>(DL, MSY)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>1</td>\n",
" <td>(DL, IAD)</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>1</td>\n",
" <td>(UA, SFO)</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" counts airlineXdest\n",
"0 6 (B6, JFK)\n",
"1 4 (OO, EVV)\n",
"2 4 (DL, ATL)\n",
"3 3 (UA, ORD)\n",
"4 2 (AA, ATL)\n",
"5 2 (WN, PHX)\n",
"6 2 (HA, OGG)\n",
"7 2 (DL, SFO)\n",
"8 1 (B6, SJU)\n",
"9 1 (DL, XNA)\n",
"10 1 (AA, PHX)\n",
"11 1 (AA, BWI)\n",
"12 1 (WN, DEN)\n",
"13 1 (WN, ATL)\n",
"14 1 (WN, LAS)\n",
"15 1 (UA, DFW)\n",
"16 1 (OO, ATL)\n",
"17 1 (UA, MSY)\n",
"18 1 (DL, MSP)\n",
"19 1 (AA, LAX)\n",
"20 1 (DL, MSY)\n",
"21 1 (DL, IAD)\n",
"22 1 (UA, SFO)"
]
},
"execution_count": 62,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"clean_flights_count.columns = ['counts','airlineXdest']\n",
"clean_flights_count"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Step 5.2 Creating Detailed Flights, Filtered by OpenFlight Routes"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>route_iata_code</th>\n",
" <th>route_airline_id</th>\n",
" <th>route_src</th>\n",
" <th>route_src_id</th>\n",
" <th>route_dest</th>\n",
" <th>route_dest_id</th>\n",
" <th>route_codeshare</th>\n",
" <th>route_nstops</th>\n",
" <th>route_equip</th>\n",
" <th>Year</th>\n",
" <th>Month</th>\n",
" <th>DayofMonth</th>\n",
" <th>AirlineID</th>\n",
" <th>Carrier</th>\n",
" <th>FlightNum</th>\n",
" <th>Origin</th>\n",
" <th>Dest</th>\n",
" <th>ArrDelayMinutes</th>\n",
" <th>Cancelled</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>9E</td>\n",
" <td>3976</td>\n",
" <td>ATL</td>\n",
" <td>3682</td>\n",
" <td>EVV</td>\n",
" <td>4018</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>CRJ</td>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>26</td>\n",
" <td>20304</td>\n",
" <td>OO</td>\n",
" <td>4644</td>\n",
" <td>ATL</td>\n",
" <td>EVV</td>\n",
" <td>58.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>AF</td>\n",
" <td>137</td>\n",
" <td>ATL</td>\n",
" <td>3682</td>\n",
" <td>EVV</td>\n",
" <td>4018</td>\n",
" <td>Y</td>\n",
" <td>0</td>\n",
" <td>CRJ</td>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>26</td>\n",
" <td>20304</td>\n",
" <td>OO</td>\n",
" <td>4644</td>\n",
" <td>ATL</td>\n",
" <td>EVV</td>\n",
" <td>58.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>DL</td>\n",
" <td>2009</td>\n",
" <td>ATL</td>\n",
" <td>3682</td>\n",
" <td>EVV</td>\n",
" <td>4018</td>\n",
" <td>Y</td>\n",
" <td>0</td>\n",
" <td>CRJ</td>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>26</td>\n",
" <td>20304</td>\n",
" <td>OO</td>\n",
" <td>4644</td>\n",
" <td>ATL</td>\n",
" <td>EVV</td>\n",
" <td>58.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>KL</td>\n",
" <td>3090</td>\n",
" <td>ATL</td>\n",
" <td>3682</td>\n",
" <td>EVV</td>\n",
" <td>4018</td>\n",
" <td>Y</td>\n",
" <td>0</td>\n",
" <td>CRJ</td>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>26</td>\n",
" <td>20304</td>\n",
" <td>OO</td>\n",
" <td>4644</td>\n",
" <td>ATL</td>\n",
" <td>EVV</td>\n",
" <td>58.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" route_iata_code route_airline_id route_src route_src_id route_dest \\\n",
"0 9E 3976 ATL 3682 EVV \n",
"1 AF 137 ATL 3682 EVV \n",
"2 DL 2009 ATL 3682 EVV \n",
"3 KL 3090 ATL 3682 EVV \n",
"\n",
" route_dest_id route_codeshare route_nstops route_equip Year Month \\\n",
"0 4018 0 CRJ 2016 10 \n",
"1 4018 Y 0 CRJ 2016 10 \n",
"2 4018 Y 0 CRJ 2016 10 \n",
"3 4018 Y 0 CRJ 2016 10 \n",
"\n",
" DayofMonth AirlineID Carrier FlightNum Origin Dest ArrDelayMinutes \\\n",
"0 26 20304 OO 4644 ATL EVV 58.0 \n",
"1 26 20304 OO 4644 ATL EVV 58.0 \n",
"2 26 20304 OO 4644 ATL EVV 58.0 \n",
"3 26 20304 OO 4644 ATL EVV 58.0 \n",
"\n",
" Cancelled \n",
"0 0.0 \n",
"1 0.0 \n",
"2 0.0 \n",
"3 0.0 "
]
},
"execution_count": 63,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"m2[m2.ArrDelayMinutes>30]"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"airline_dest_delay_full = airline_dest.merge(m2[(m2.ArrDelayMinutes>30) | (m2.Cancelled>0)],left_on=['airline_iata2_code','route_dest'],right_on = ['Carrier','route_dest'])"
]
},
{
"cell_type": "code",
"execution_count": 65,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>airline_iata2_code</th>\n",
" <th>route_dest</th>\n",
" <th>route_iata_code</th>\n",
" <th>route_airline_id</th>\n",
" <th>route_src</th>\n",
" <th>route_src_id</th>\n",
" <th>route_dest_id</th>\n",
" <th>route_codeshare</th>\n",
" <th>route_nstops</th>\n",
" <th>route_equip</th>\n",
" <th>Year</th>\n",
" <th>Month</th>\n",
" <th>DayofMonth</th>\n",
" <th>AirlineID</th>\n",
" <th>Carrier</th>\n",
" <th>FlightNum</th>\n",
" <th>Origin</th>\n",
" <th>Dest</th>\n",
" <th>ArrDelayMinutes</th>\n",
" <th>Cancelled</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>AA</td>\n",
" <td>BWI</td>\n",
" <td>JJ</td>\n",
" <td>4867</td>\n",
" <td>MIA</td>\n",
" <td>3576</td>\n",
" <td>3849</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>777</td>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>6</td>\n",
" <td>19805</td>\n",
" <td>AA</td>\n",
" <td>194</td>\n",
" <td>MIA</td>\n",
" <td>BWI</td>\n",
" <td>NaN</td>\n",
" <td>1.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>OO</td>\n",
" <td>EVV</td>\n",
" <td>9E</td>\n",
" <td>3976</td>\n",
" <td>ATL</td>\n",
" <td>3682</td>\n",
" <td>4018</td>\n",
" <td></td>\n",
" <td>0</td>\n",
" <td>CRJ</td>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>26</td>\n",
" <td>20304</td>\n",
" <td>OO</td>\n",
" <td>4644</td>\n",
" <td>ATL</td>\n",
" <td>EVV</td>\n",
" <td>58.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>OO</td>\n",
" <td>EVV</td>\n",
" <td>AF</td>\n",
" <td>137</td>\n",
" <td>ATL</td>\n",
" <td>3682</td>\n",
" <td>4018</td>\n",
" <td>Y</td>\n",
" <td>0</td>\n",
" <td>CRJ</td>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>26</td>\n",
" <td>20304</td>\n",
" <td>OO</td>\n",
" <td>4644</td>\n",
" <td>ATL</td>\n",
" <td>EVV</td>\n",
" <td>58.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>OO</td>\n",
" <td>EVV</td>\n",
" <td>DL</td>\n",
" <td>2009</td>\n",
" <td>ATL</td>\n",
" <td>3682</td>\n",
" <td>4018</td>\n",
" <td>Y</td>\n",
" <td>0</td>\n",
" <td>CRJ</td>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>26</td>\n",
" <td>20304</td>\n",
" <td>OO</td>\n",
" <td>4644</td>\n",
" <td>ATL</td>\n",
" <td>EVV</td>\n",
" <td>58.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>OO</td>\n",
" <td>EVV</td>\n",
" <td>KL</td>\n",
" <td>3090</td>\n",
" <td>ATL</td>\n",
" <td>3682</td>\n",
" <td>4018</td>\n",
" <td>Y</td>\n",
" <td>0</td>\n",
" <td>CRJ</td>\n",
" <td>2016</td>\n",
" <td>10</td>\n",
" <td>26</td>\n",
" <td>20304</td>\n",
" <td>OO</td>\n",
" <td>4644</td>\n",
" <td>ATL</td>\n",
" <td>EVV</td>\n",
" <td>58.0</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" airline_iata2_code route_dest route_iata_code route_airline_id route_src \\\n",
"0 AA BWI JJ 4867 MIA \n",
"1 OO EVV 9E 3976 ATL \n",
"2 OO EVV AF 137 ATL \n",
"3 OO EVV DL 2009 ATL \n",
"4 OO EVV KL 3090 ATL \n",
"\n",
" route_src_id route_dest_id route_codeshare route_nstops route_equip \\\n",
"0 3576 3849 0 777 \n",
"1 3682 4018 0 CRJ \n",
"2 3682 4018 Y 0 CRJ \n",
"3 3682 4018 Y 0 CRJ \n",
"4 3682 4018 Y 0 CRJ \n",
"\n",
" Year Month DayofMonth AirlineID Carrier FlightNum Origin Dest \\\n",
"0 2016 10 6 19805 AA 194 MIA BWI \n",
"1 2016 10 26 20304 OO 4644 ATL EVV \n",
"2 2016 10 26 20304 OO 4644 ATL EVV \n",
"3 2016 10 26 20304 OO 4644 ATL EVV \n",
"4 2016 10 26 20304 OO 4644 ATL EVV \n",
"\n",
" ArrDelayMinutes Cancelled \n",
"0 NaN 1.0 \n",
"1 58.0 0.0 \n",
"2 58.0 0.0 \n",
"3 58.0 0.0 \n",
"4 58.0 0.0 "
]
},
"execution_count": 65,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"airline_dest_delay_full"
]
},
{
"cell_type": "code",
"execution_count": 66,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"airline_dest_delay=airline_dest_delay_full.ix[:,['airline_iata2_code','route_dest']]"
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"airline_dest_delay['airline_dest'] = list(zip(airline_dest_delay.airline_iata2_code, airline_dest_delay.route_dest))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 5.2.3 Multiply-Delayed Flights by Airline and Destination"
]
},
{
"cell_type": "code",
"execution_count": 68,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"delay30 = airline_dest_delay.drop(['airline_iata2_code','route_dest'],axis = 1).airline_dest.value_counts().to_frame()"
]
},
{
"cell_type": "code",
"execution_count": 69,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"delay30.columns = ['delays_more_than_30']"
]
},
{
"cell_type": "code",
"execution_count": 70,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>delays_more_than_30</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>(OO, EVV)</th>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(AA, BWI)</th>\n",
" <td>1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" delays_more_than_30\n",
"(OO, EVV) 4\n",
"(AA, BWI) 1"
]
},
"execution_count": 70,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"delay30"
]
},
{
"cell_type": "code",
"execution_count": 71,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f883be7fda0>"
]
},
"execution_count": 71,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAgAAAAGbCAYAAACyMSjnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzt3XmYHWWZ///33QTpDiRBCSEJsgVCDIbFBBSRJazRMDMs\nxqVBTAARgfmhPaO4DQqMCoiQkUFEBln8ZqZVEMTRgbBIJjCCaEJkkLCMEIICgYgGJSSAuX9/nNNt\nd6e3c/qkT5J6v67rXFBPPXXq7i31OU9VPRWZiSRJKpaGehcgSZIGnwFAkqQCMgBIklRABgBJkgrI\nACBJUgEZACRJKiADgCRJBWQAkCSpgAwAkiQVkAFAkqQCGlAAiIjPRMSaiLikj35TI2JBRKyKiMci\nYuZA9itJkgam6gAQEfsAHwV+1Ue/HYEfA3cCewJfB66KiMOr3bckSRqYqgJARGwBzAE+Avyxj+6n\nAU9k5lmZ+WhmfgO4AWipZt+SJGngqh0B+Abwn5n503703Re4o0vbXOCdVe5bkiQN0JBK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667ssUWW3Tatq3PokWLKt5vVTJzvXtR+iiQCxYs\nyI3ZggULEkhYkJC+NvhX6ee5Pv/etv3Oda1x/fldHNj38Oijj86hQ4fmb3/72/a2Rx55JIcMGZIN\nDQ2ZmblkyZIcMmRIXnDBBZ22/fWvf52bbrppnn/++e1ts2bNyp122qlTv1WrVnVafv3113P33XfP\nww47rL1txYoV2dTUlJ/97Gc79T3zzDNz2LBhuXLlyszM/MQnPpFbbrllVV9rRxGRTU1NuXTp0va2\nK6+8MiMix44dmy+//HJ7++c+97lsaGjIp556KjMzX3vttdxmm21yzz33zNWrV7f3+8lPfpIRkeec\nc05726xZs7KhoSE///nPr1XDrrvumtOnT+/UtmrVqhw3blxOmzat31/L8uXLMyLy3HPPXWtd2/6/\n/OUvd2qfPHly7rPPPmvtu6Pufk6Zpe9dY2NjPvnkk+1tDz74YEZEfuMb3+h33W3uu+++jIj218SJ\nE3P+/Pmd+kyaNGmtOjIzH3744YyIvPLKK3t8/57+hrvrA0zO7PlY6wiApI3CmjVruO222zjmmGPY\ndttt29snTJjAtGnT2pdvvPFGMpP3ve99/P73v29/jRo1ivHjx3PXXXf1up/NNtus/f//+Mc/8oc/\n/IEDDjiAhQsXtrcPHz6co446itbW1k71ff/73+eYY46hqakJgC233JKXX365JsPNhx12GNttt137\n8jve8Q4AZsyY0ekcfVv7E088AcAvf/lLnn/+eU4//XTe8IY3tPebPn06b3nLW/jJT36y1r4+9rGP\ndVpetGgRjz/+OM3NzZ2+p3/605849NBDuz03PhCnnnpqp+UDDjig/etp05+fU5vDDz+cHXfcsX15\n9913Z/jw4Wu9Z3/stttu3HHHHdx88818+tOfZvPNN19rVOmVV17pVF+bxsbG9vWDwYsAJW0UXnjh\nBV555RV22WWXtdZNmDChfej3//7v/1izZk23/SKi00GwOz/+8Y/58pe/zKJFi1i9enV7e9d5Bj78\n4Q/z/e9/n3vuuYf999+f22+/neeff759+B/g9NNP5/rrr2f69OmMHTuWI444gve///2dAkt/dTz4\nA4wYMQKAN7/5zWu1Z2b78PZTTz1FRLDrrruu9Z5vectb+J//+Z9ObUOGDFnrPR9//PH2r7k7DQ0N\nrFixor2mgWhsbGSrrbbq1PbGN75xreH6/v6cYO3vXU/v2R/Dhg3jkEMOAeBv//Zv2WOPPTjqqKN4\n4IEH2H333QFoamrqVFObVatWta8fDAYASYWyZs0aGhoauPXWW7s9GHQ9L9vR3XffzVFHHcXUqVP5\n5je/yZgxY9h00025+uqrO33aB5g2bRqjRo1izpw57L///syZM4fRo0dz6KGHtvfZeuutWbRoEXPn\nzuWWW27hlltu4ZprrmHmzJlcc801FX1dm2yySUXtmVnR+7fp7pPrmjVrALj44ovZc889u92ut+9r\nJXr6ejqq5OfU23tW+z3q6Nhjj+WEE07gu9/9bnsAGDNmzFoXWAI8++yzAIwdO3bA++0PA4CkjcLW\nW29NU1NT+6fRjh555JH2/995553JTHbcccduRwF6c+ONN9LU1MTcuXMZMuSv/3x++9vfXqtvQ0MD\nxx13HNdddx0XXHABN998M6eeeupaE9kMGTKEI488kiOPPBKA0047jSuvvJKzzz6bcePGVVRfNdqu\nUn/00UeZOnVqp3WPPvooO+ywQ5/vsfPOOwOdP/1WqxYT/VTyc1rXVq9ezZo1a1ixYkV721577cW8\nefP485//3CkY3XfffUREj3eQ1JrXAEjaKDQ0NDBt2jR++MMfdrqdb/Hixdx2223ty8ceeywNDQ2c\ne+653b7Piy++2OM+Ntlkk/Yr4dssWbKEm2++udv+J5xwAi+++CKnnnoqL7/8Mscff3yf+2r7lNjd\nEPG6sPfeezNq1CiuuOIKXnvttfb2W265pf1Ogr5MmTKFnXfema997Wu8/PLLa62vZIbJtusVOt42\nV6lKf061sGLFik77a/Nv//ZvRAT77LNPe9uMGTN4/fXXO9258Oqrr3Lttdey7777drqGZV1yBEBS\nB4s36P2fe+653Hrrrey///6cfvrpvPbaa1x22WVMmjSJBx98EChNzPKlL32Jz33uczz55JPt95M/\n8cQT/PCHP+TUU0/lH/7hH7p9/yOPPJJLLrmEadOmcdxxx7Fs2TIuv/xyxo8f3/7+He21115MmjSJ\n66+/nt12222tT3Yf+chHePHFFznkkEN485vfzJIlS7jssst429vexsSJgzMh05AhQ7jwwgs56aST\nOPDAA2lubua5557j0ksvZdy4cXziE5/o8z0igquuuorp06fz1re+lRNPPJFtt92W3/3ud9x1112M\nGDGi3wffxsZGdtttN773ve8xfvx43vSmNzFp0iTe+ta39vtrqvTnVAvz5s3jzDPPZMaMGYwfP55X\nX32V+fPnc9NNN7HPPvt0Cn9vf/vbed/73sdnP/tZli1b1j4T4FNPPVXxqZ8B6e0WgXq98DZAXxvk\na8O9DfCpp57KxsahbbcO1fXV2Di0/Ra1atx99925zz77ZGNjY+6yyy555ZVX5jnnnNN+G2Cbm266\nKQ888MAcNmxYDhs2LHfbbbc888wz8/HHH2/vM2vWrBw3blyn7a655pqcMGFCNjU15W677ZbXXXdd\nt+/f5qKLLsqIyAsvvHCtdTfeeGO++93vztGjR2djY2PuuOOOefrpp+eyZcsq+pobGhryzDPP7NS2\nZMmSbGhoyEsuuaRT+7x587KhoSF/8IMfdGq//vrrc8qUKdnU1JQjR47MD3/4w/nMM8906jNr1qwc\nPnx4j3X86le/yhkzZuTWW2+dTU1NudNOO+UHP/jBvOuuuyr6eu677772n2FDQ0P7LYE97f+cc87J\nTTbZpFNbf39O3X3vMjN32mmnPOmkk/pd829+85ucNWtW7rLLLrn55pvn0KFDc/fdd8/zzjuv/bbP\njlavXp1nnXVWjh07NpuamvId73hH3n777X3up5a3AUaWDrjrlYiYDCxYsGABkydPrnc568zChQuZ\nMmUKsIBS5tGGbSEwhfX597btd667GjfmhwHV09e//nX+8R//kSVLlqx19bxUqd7+hrv2AaZk5tr3\nPZZ5CkASANtvv/1GdeBdX1x99dVMnTrVg7/WOwYASaqxlStXcvPNN3PXXXfx0EMP8aMf/aiq91m2\nbFmv65uamhg+fHhV7z3Y1qxZwwsvvNBrny222GKtx+bW24Zad38YACSpxl544QWOP/543vjGN/L5\nz3++/Ra/So0ZM4aIoLtTt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JEkqIAOAJEkF9P8D\nfTdvNZS3u6QAAAAASUVORK5CYII=\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7f883c06a390>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"delay30.plot.bar()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 5.2.4 Multiply Delayed Flights by Airline"
]
},
{
"cell_type": "code",
"execution_count": 80,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"bad_airlines = m2.ix[:,'Carrier'][(m2.ArrDelayMinutes>30) | (m2.Cancelled>0)].value_counts().to_frame()"
]
},
{
"cell_type": "code",
"execution_count": 81,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"bad_airlines.columns = ['Delayed_flights']"
]
},
{
"cell_type": "code",
"execution_count": 82,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Delayed_flights</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>OO</th>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>AA</th>\n",
" <td>1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Delayed_flights\n",
"OO 4\n",
"AA 1"
]
},
"execution_count": 82,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bad_airlines"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment