Assignment 7
Contents
Assignment 7¶
If you have installed Python locally, launch JupyterLab by running:
conda activate sds
and
jupyter lab
![substation](../_images/substation.jpg)
Task 1 (5 points)¶
Download the data for the assignment here. This dataset contains hourly sources of electricity generated in the Pacific Northwest (in MWh) between May 16, 2022 to June 14, 2022. If you are interested, the data were downloaded from here.
Read the data using Pandas
, setting the datetime
column as the index. Answer the following questions:
a) How many rows and columnns are in this table?
b) What are the column names?
c) Which sources generate the most/least electricity on average during this time period?
Task 2 (5 points)¶
Make a visually-appealing plot showing the sources of electricity generated by wind, solar, hydro, natural gas, and coal.
Task 3 (5 points)¶
On which day was highest/lowest amount electricity generated for each source?
Click to reveal hint
Consider using resample()
.
Task 4 (5 points)¶
Make a new column called hour
that contains the hour of the day as an integer for each row.
Click to reveal hint
Pandas
has some useful functions for this - df.index.hour
a) On which hour of the day is most/least electricity generated by solar?
b) On which hour of the day is most/least electricity generated by natural gas?
Click to reveal hint
Consider using the grouby()
function to group by hour (see demo on Week 4).
Task 5 (5 points)¶
a) Compute the weekly average electricity generated by wind, solar, hydro, natural gas, and coal using a rolling window.
b) Make a visually-appealing plot to show this new data.
b) With reference to this plot, hypothesize which sources of electricity are likely to up/down/stay the same between June 14 and June 21, 2022.
Task 6 (5 points)¶
For each source, which day of the week (i.e. Mon, Tue, Wed) was most/least electricity generated? Please print out a day of the week instead of an integer.
Click to reveal hint
Again, Pandas
has some useful functions for this - df.index.dayofweek
Important
Save your notebook to your local course folder and submit assignment (in .pdf format) to Canvas by the deadline.