# Spring 2024 Quiz 2

This quiz was administered in-person. It was closed-book and closed-note; students were not allowed to use the DSC 10 Reference Sheet. Students had 20 minutes to work on the quiz.

This quiz covered Lectures 5-9 of the Spring 2024 offering of DSC 10.

An art museum records information about its collection in a DataFrame called art. The columns of art are as follows:

• "title" (str): the name of the art piece.
• "artist" (str): the name of the artist.
• "year" (int): the year the art piece was produced.
• "price" (float): the selling price of hte art piece in dollars

## Problem 1

##### Difficulty: ⭐️⭐️⭐️

The average score on this problem was 55%.

## Problem 4

### Problem 4.1

Fill in the return statement of the function is_expensive, which takes as input the price of an art piece (as a float, in dollars) and returns True if the price is more than 20 million dollars. Otherwise, it returns False.

def is_expensive(price):
return ___(a)___

Answer: price > 20_000_000

##### Difficulty: ⭐️⭐️⭐️

The average score on this problem was 74%.

### Problem 4.2

Write one line of code to add a new column called exp to the art DataFrame, which categorizes if each art piece is worth more than 20 million dollars, using Boolean values. You must use the is_expensive function you wrote above. Make sure to modify art!

Answer: art = art.assign(exp = art.get("price").apply(is_expensive))

##### Difficulty: ⭐️⭐️⭐️

The average score on this problem was 73%.

### Problem 4.3

Next, we make a new DataFrame called expensive as follows.

expensive = art[art.get(exp)]
merged = art.merge(expensive, on="artist")

Van Gogh is one artist represented in art and exactly half of his pieces in art are worth over 20 million dollars. If Van Gogh’s art appears in 72 rows of the merged DataFrame, how many rows does Van Gogh actually have in the original art DataFrame?