Question: Please use the 3 csv files to work with this lab activity. Aug 2 4 Delays.csv , July 2 4 Delays.csv , June 2 4

Please use the 3 csv files to work with this lab activity. Aug24Delays.csv, July24Delays.csv, June24Delays.csv You will create a flight delay tracker that asks the user for origin and destination airports and airline and then prints out stats for flight delays meeting that criteria as well as a histogram of those delay distributions. To accomplish this, you'll have 2 modules: delay_mod.py - create a Delay class that has 4 global variables (df_flight, origin, destination, airline) and 8 functions, including 2 dunder functions (def __init__ and def __str__)__init__ function - read in the appropriate amount of csv files (1,2, or 3) and set them as your df_flight pandas dataframe __str__ function - returns Origin, Destination, Airline, and Number of Flights in a string set_origin, set_destination, set_airline - all take 1 argument and filter the df_flight dataframe for that specific airport/airline print_stats - prints out number of flights, mean and median delays, and percent of flights more than 15 minutes late. Hint - use pandas filtering and agg (with count, median, mean) to get these stats. plot_hist - if your mean delay is greater than 15 minutes, plot a red histogram; otherwise plot a green histogram. Use parameters color, bins, and density=True to arrange your graph similar to below. You can use plt.xlim(-30,90) to get a more zoomed in graph. list_options - if origin ="", then print out all of the origin airports and airlines using the pandas column and .unique(). Otherwise (else), print out all of the destination airports and airlines. (Shown below) run_app.py - set up a loop where it asks the user for origin, destination, airline, and then Enter to exit and sets those as part of a Delay object First, ask the user how many months back they want to go (1- just Aug24,2- Aug&July24,3- June,July,Aug24). Convert that to an integer and use that as the 1 argument when you create (initialize) your Delay object. In your Delay class, you'll use the __init__ function to take that number as an argument (1,2, or 3) and then use pandas and if statements to read in the appropriate csvs and concatenate them together with pd.concat([df1,df2,..]). Your final output should be Mean and Median delay as well as how many percent of flights were over 15 minutes late (print_stats function) as shown below, as well as a histogram (plot_hist function)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!