Question: import pandas as p d import numpy as n p def monthly _ airport _ delays ( flights _ df ) : flights _ df
import pandas as
import numpy as
def monthlyairportdelaysflightsdf:
flightsdf 'MONTH'pdtodatetimeflightsdf SCHEDULEDDEPARTURE'dtstrftimeB
flightsdf DELAYED npwhereflightsdf DEPARTUREDELAY'
monthlydelaysflightsdfgroupby ORIGINAIRPORT', 'MONTH'DELAYEDmeanresetindex
monthlydelayspivot monthlydelays.pivot index'MONTH', columns ORIGINAIRPORT', values'DELAYED'
return monthlydelayspivot
monthlyairportdelaysdf monthlyairportdelaysflightsdfraw.copy
printmonthlyairportdelaysdf
ORIGINAIRPORT
ATL
BOS
BWI
CLT
DEN
DFW
MONTH
January
ORIGINAIRPORT
DTW
EWR
IAH
JFK
LAS
LAX
MONTH
January
ORIGINAIRPORT
LGA
MCO
MSP
ORD
PHX
SEA
MONTH
January
ORIGINAIRPORT
SF
SLC
MONTH
January
monthlyairportdelaysdf monthlyairportdelaysflightsdfraw.copy
AssertionError: the shape of the dataframe supplied is incorrect expecting
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
