Pages

Sunday, 9 August 2015

AIRLINE ROUTE HISTOGRAM

Let's step into real world. We will solve an airline data set problem. For this we need two data sets airport data and route data which can be downloaded from OpenFlights Data Page. Both the files will be in dat format(.dat).In addition to that we need geo_distance function( ) which will be used later and can be downloaded from here. Now we have airport and route data and geo_function python programme in working directory. This should get us started.
Observe the data of airports in  text editor to get an overview. First we import data into programme and print the name of the every airport. As we have observed the data in every row second column is the airport name, so we have used index 1 (index 0 is the first field).
We decided to print airports only for a certain countries such as Australia and Russia. Here if condition will check third index of every row whether Australia or Russia and if it is true it prints the first index of that row which is airport name.

We now calculate how far each route travels and draw histogram showing  the distribution of distances flown. First we create the latitudes and longitudes as dictionaries.
Now as we have downloaded geo_distance we will now import into our programme and find distances making distances as list
Finally we will create a histogram displaying the frequency of flights by distance.



No comments:

Post a Comment