Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

based on the python code: import pandas as pd import re # Load the data flights = pd.read_csv('data-sets/flights.csv') planes = pd.read_csv('data-sets/planes.csv') airlines = pd.read_csv('data-sets/airlines.csv') airports

based on the python code:

import pandas as pd import re # Load the data flights = pd.read_csv('data-sets/flights.csv') planes = pd.read_csv('data-sets/planes.csv') airlines = pd.read_csv('data-sets/airlines.csv') airports = pd.read_csv('data-sets/airports.csv') # Step 1: Merge planes and flights data on 'tailnum' planes_subset = planes[['tailnum', 'model', 'manufacturer']] flights2 = flights.merge(planes_subset, on='tailnum', how='inner') # Step 2: Merge airlines data into flights data on 'carrier' flights3 = flights2.merge(airlines, left_on='carrier', right_on='carrier', how='left') # Step 3: Merge airports data into flights data on 'dest' airports_subset = airports[['faa', 'latitude', 'longitude']] flights_final = flights3.merge(airports_subset, left_on='dest', right_on='faa', how='left')

find:

a)We can see in the data set that only some of the planes have tail numbers that end in two letters. We would like to generate a dictionary that contains the last two letters in a tail number, for each of the different carriers in the data set.

b)Determine how many flights went to each of the destinations from New York in January of 2013. Store this in a data frame called flightCount.

Hint: the to_frame() function may be helpful. Then generate a new data frame called temp that merges the flights_final data with flightCount. The code that is provided will then plot the flight data on the map of the US.

  1. Provide a brief description of what the code that has been provided to you is doing.
  2. Provide at least 1 insight into what this graph tells us about flights from new York

fig, ax = plt.subplots(figsize=(8,6))

earthPath = geopandas.datasets.get_path("naturalearth_lowres")

world = geopandas.read_file(earthPath)

usa = world.loc[world['name'] == 'United States of America']

usa.plot(color = 'white', edgecolor = 'black', ax = ax)

size = temp['dest_y']/temp['dest_y'].max()*100

flights_final.plot(x = 'lon', y = 'lat', kind = 'scatter', s = size, ax = ax)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

=+How is our position superior to competitors?

Answered: 1 week ago

Question

=+5. Develop an upbeat closing.

Answered: 1 week ago