Question: we need to prepare a DataFrame that counts the number of non - zero precipitation hours each day. This is done for you below when
we need to prepare a DataFrame that counts the number of nonzero precipitation hours each day. This is done for you below when creating dailycounts
dailycounts
dfgroupbypdGrouperkeydt freqD
agg
"precip": lambda x: x sum "mean", "sum"
"temp": min 'max'
assignmonthlambda x: xindex.month
dropna
dailycounts.columns npreciphours", "avehourlyprecip", "dailyprecip", "tempmin", "tempmax", "month"
dailycounts.head
Using this DataFrame and the statsmodels library, fit the appropriate GLM model to predict the number of hours with nonzero precipitation in a day
You shoud use as features, tempmin, tempmax, and a collection of indidcator variables for the month. In total you will have features.
# countmodel smfglm
# # CHANGE FORMULA
# dailycounts,
# family # CHANGE FAMILY
#
# your code here
countmodelfit countmodel.fit
countmodelfit.summary
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
