diff --git a/docs/sp24-midterm/index.html b/docs/sp24-midterm/index.html index 8c80ad0..986600c 100644 --- a/docs/sp24-midterm/index.html +++ b/docs/sp24-midterm/index.html @@ -137,6 +137,39 @@
The h
table records addresses within San Diego. Only 50
+addresses are recorded. The index of the dataframe contains the numbers
+1-50 as unique integers.
"number" (int)
: Street address number"street" (str)
: Street nameThe o
table records information on power outages within
+San Diego in April 2024. Only 100 outages are recorded. The index of the
+dataframe contains the numbers 1-100 as unique integers.
"time" (pd.Timestamp)
: When the outage began"duration" (int)
: How long the outage lasted in
+minutesThe j
table is a table that links outages to addresses.
+Each entry in the j
table contains the hid
of
+the affected address and the oid
of the outage. For
+example, the first row of the table records that the outage with an
+oid
of 1 caused the power to go out at addresses with
+hid
61 and 88. A single outage can affect multiple
+addresses. There are no missing values and no duplicated rows in this
+table, and all values are positive integers. This table records all the
+addresses affected by all of the outages in 2024 so far.
"hid" (int)
: The hid
of the affected
+address"oid" (int)
: The oid
of the outageFill in Python code below so that the last line of each part
evaluates to each desired result using the tables h
,
@@ -328,41 +361,107 @@
h
, j
, and o
, then
perform the join by hand. For example, consider the following example
h
, j
, and o
tables:
-hid | +
---|
1 | +
2 | +
3 | +
hid | +oid | +
---|---|
1 | +1 | +
2 | +1 | +
2 | +10 | +
2 | +11 | +
10 | +3 | +
11 | +3 | +
oid | +
---|
1 | +
2 | +
3 | +
In this example, whoa
would look like the following
(omitting other columns besides hid
and oid
for brevity):
hid | +oid | +
---|---|
1 | +1 | +
2 | +1 | +
NaN | +2 | +
NaN | +3 | +
There are 3 cases where rows will be kept for whoa
:
hid
and oid
match in the three
diff --git a/pages/exams/sp24-midterm.yml b/pages/exams/sp24-midterm.yml
index 27dbb80..74be09a 100644
--- a/pages/exams/sp24-midterm.yml
+++ b/pages/exams/sp24-midterm.yml
@@ -2,6 +2,7 @@ title: 'Spring 2024 Midterm Exam'
instructors: Sam Lau
context: This exam was administered in-person. The exam was closed-notes, except students were allowed to bring a single two-sided notes sheet. No calculators were allowed. Students had **80 minutes** to take this exam.
show_solution: true
+data_info: sp24-midterm/sp24-midterm-data-info
problems:
- sp24-midterm/sp24-mid-q01
- sp24-midterm/sp24-mid-q02
diff --git a/problems/sp24-midterm/sp24-mid-q02.md b/problems/sp24-midterm/sp24-mid-q02.md
index be5a825..b026280 100644
--- a/problems/sp24-midterm/sp24-mid-q02.md
+++ b/problems/sp24-midterm/sp24-mid-q02.md
@@ -40,15 +40,14 @@ Write a **single expression** that evaluates to the number of rows in `whoa`. In
We know that `h` has the numbers 1-50 as unique integers in its index, and `o` has the numbers 1-100 as unique integers in its index. However, the `hid` and `oid` columns in `j` have values outside these ranges. To approach this problem, it's easiest to come up with smaller versions of `h`, `j`, and `o`, then perform the join by hand. For example, consider the following example `h`, `j`, and `o` tables:
-