As a person who likes to travel a lot, and an expat who travels to his native country a lot, I accumulate a lot of flights. In fact, I keep a spreadsheet of all flights I’ve been on. Since I am currently teaching myself data engineering in python, I thought it was a good exercise to visualize the flight data contained in my spreadsheet, along with a list of places I’ve visited in my life.
The red markers in the above map represent places I’ve visited. The raw data were simply a list of cities I wrote down in a text file. I imported this file with pandas and used the geopy module to look up the geographic coordinates for each place. Then I created a map using the basemap module and plotted the visited places in it. Basemap allows you to draw maps with all kinds of projections, and having traveled exclusively on the northern hemisphere, this “polar Lambert azimuthal projection” seems like a great choice.
The flight data from my spreadsheet were also loaded into a pandas DataFrame. I then cross-referenced the three-letter IATA airport codes in my spreadsheet with a data set of over 50,000 airports and obtained each airport’s geographical coordinates by merging the respective DataFrames. Using the coordinates and basemap‘s drawgreatcircle method, I drew each flight on the map.
The jupyter notebook of this project is available on GitHub.
You must be logged in to post a comment.