CoCalc Public Filesfinal discuss.ipynb
Views : 180
Compute Environment: Ubuntu 20.04 (Default)
In [1]:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

In [2]:
df=pd.read_csv('airlines.csv')
df.columns

Index(['Airport.Code', 'Airport.Name', 'Time.Label', 'Time.Month', 'Time.Month Name', 'Time.Year', 'Statistics.# of Delays.Carrier', 'Statistics.# of Delays.Late Aircraft', 'Statistics.# of Delays.National Aviation System', 'Statistics.# of Delays.Security', 'Statistics.# of Delays.Weather', 'Statistics.Carriers.Names', 'Statistics.Carriers.Total', 'Statistics.Flights.Cancelled', 'Statistics.Flights.Delayed', 'Statistics.Flights.Diverted', 'Statistics.Flights.On Time', 'Statistics.Flights.Total', 'Statistics.Minutes Delayed.Carrier', 'Statistics.Minutes Delayed.Late Aircraft', 'Statistics.Minutes Delayed.National Aviation System', 'Statistics.Minutes Delayed.Security', 'Statistics.Minutes Delayed.Total', 'Statistics.Minutes Delayed.Weather'], dtype='object')
In [3]:
df2=df.pivot(index='Airport.Code', columns='Time.Label',values='Statistics.# of Delays.Weather')

In [4]:
column = df2['2008/05']

Airport.Code Airport.Name Time.Label Time.Month Time.Month Name Time.Year Statistics.# of Delays.Carrier Statistics.# of Delays.Late Aircraft Statistics.# of Delays.National Aviation System Statistics.# of Delays.Security ... Statistics.Flights.Delayed Statistics.Flights.Diverted Statistics.Flights.On Time Statistics.Flights.Total Statistics.Minutes Delayed.Carrier Statistics.Minutes Delayed.Late Aircraft Statistics.Minutes Delayed.National Aviation System Statistics.Minutes Delayed.Security Statistics.Minutes Delayed.Total Statistics.Minutes Delayed.Weather
0 ATL Atlanta, GA: Hartsfield-Jackson Atlanta Intern... 2003/06 6 June 2003 1009 1275 3217 17 ... 5843 27 23974 30060 61606 68335 118831 518 268764 19474
1 BOS Boston, MA: Logan International 2003/06 6 June 2003 374 495 685 3 ... 1623 3 7875 9639 20319 28189 24400 99 77167 4160

2 rows × 24 columns

In [5]:
def delayed(n):
print('The Airport code at the top of the list that have the most weather delayed for 2008/05')

delayed(1)



--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-8-0878dcdf71c7> in <module> ----> 1 weatherDelays= ordered.iloc[0] 2 Airport= weatherDelays[aiportName] 3 print(Airport) NameError: name 'ordered' is not defined