Search for question
Question

6.13 LAB EdStem: Flight status (line plot) This lab will be done in EdStem workspace. Follow the ITEC136 Coding Convention for coding guidelines and styles. You will submit the lab here. The LAX dataset contains the flight status at the Los Angeles International Airport in a given year and has the following column labels: Month, Cancelled, Delayed, Diverted, and On Time. Download the LAX dataset files and upload to EdStem workspace. Given a CSV file name read from user input, write a program that performs the following tasks: Read in the CSV file as a dataframe. Output the average of flight delays and the average of flight cancellations, with two digits after the decimal point. Follow the output format in the example below. Create a lineplot of the number of flights delayed each month. Label the plot "Delays". In the same figure, create another lineplot of the number of flights cancelled each month. Label the plot "Cancellations". Add the x-label ("Months", fontsize = 10), y-label ("Number of flights", fontsize = 10), title ("Flight status at LAX", fontsize = 14), and a legend to the figure. Save the figure as output_fig.png. Note: You must name the Python file flight.py. System will not accept any other name. Note: The program must have title, xlabel, ylabel, legend, and savefig to receive full credit. Use this starter code. import matplotlib.pyplot as plt import pandas as pd file = input() # TODO: Read in the CSV file as a dataframe # TODO: Print the average of flight delays and flight cancellations # TODO: Create a lineplot of flight delays vs months # TODO: In the same figure, create a lineplot of flight cancellations vs months # TODO: Add axis labels, title, and legend # Save figure as output_fig.png