← return to practice.dsc10.com
This quiz was administered in-person. It was closed-book; students
were not allowed to use the DSC 10 Reference Sheet but
were allowed a double-sided sheet of handwritten notes. Students had
20 minutes to work on the quiz.
This quiz
covered Lectures 6-9 of the Spring 2025 offering
of DSC 10.
The DataFrame ghibli
contains information about all 25
films produced by Studio Ghibli, the acclaimed Japanese animation
studio. For each film, we have its "Name"
,
"Director"
, "Budget"
and
"Revenue"
(both in millions of dollars), primary
"Genre"
, and "Runtime"
in minutes.
ghibli
has 25 rows. The first two are shown below.
Fill in the blanks below to add a new column to ghibli
called "TimeString"
, containing the runtime of each film as
a string in hours and minutes. For example, Spirited Away is
125 minutes long, so its value in the "TimeString"
column
would be "2 hours, 5 minutes"
.
def change_time(mins):
= ___(a)___
hours = ___(b)___
minutes return str(hours) + " hours, " + str(minutes) + " minutes"
= ghibli.assign(TimeString = ___(c)___) ghibli
Answer (a): int(mins / 60)
The average score on this problem was 73%.
Answer (b): mins % 60
The average score on this problem was 62%.
Answer (c):
ghibli.get("Runtime").apply(change_time)
The average score on this problem was 85%.
Below is a density histogram showing the distribution of
"Runtime"
, in minutes, for all 25 films in ghibli
.
How many Studio Ghibli films are at least 90 minutes long?
Answer: 19
The average score on this problem was 79%.
Imagine we changed our histogram to have just one bin, from 70 to 140 minutes. What would the height of this bin be? Give your answer as an exact fraction or decimal.
Answer: \frac{1}{70}
The average score on this problem was 58%.
Using ghibli
, write one line of code that outputs a
DataFrame describing how many films of each genre each director has
directed.
Answer:
ghibli.groupby(["Director", "Genre"]).count()
The average score on this problem was 86%.
Kate loves Studio Ghibli and she has been recording her viewings of
their films in the kate
DataFrame, which is shown in full
below. Note that kate
has repeated rows since Kate watched
some films twice.
In ghibli
, there are 11 films directed by Hayao Miyazaki
and only 2 directed by Hiromasa Yonebayashi.
How many rows are in the DataFrame resulting from
ghibli.merge(kate, on="Director")
?
Answer: 81
The average score on this problem was 46%.
The scatter plot below shows the budget and revenue (in millions of
dollars) for each of the 6 distinct films in kate
. Answer
each question below, or write “not enough info" if you don’t have enough
information to answer.
How many of these films had less than 200 million dollars in revenue?
Answer: 4
The average score on this problem was 98%.
How many of these films earned a revenue more than five times their budget?
Answer: 4
The average score on this problem was 85%.