Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 non-zero precipitation hours each day. This is done for you below when creating `daily_counts`
daily_counts =(
df.groupby(pd.Grouper(key="dt", freq="D"))
.agg({
"precip": [lambda x: (x >0).sum(), "mean", "sum"],
"temp": ['min', 'max'],
})
.assign(month=lambda x: x.index.month)
).dropna()
daily_counts.columns =["n_precip_hours", "ave_hourly_precip", "daily_precip", "temp_min", "temp_max", "month"]
daily_counts.head()
Using this DataFrame and the statsmodels library, fit the appropriate GLM model to predict the number of hours with non-zero precipitation in a day
You shoud use as features, temp_min, temp_max, and a collection of indidcator variables for the month. In total you will have 14 features.
# count_model = smf.glm(
# ..., # CHANGE FORMULA
# daily_counts,
# family=... # CHANGE FAMILY
# )
# your code here
count_model_fit = count_model.fit()
count_model_fit.summary()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What does JIT stand for?

Answered: 1 week ago