midterm 1 data 8 fill in blank code

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/21

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 10:00 PM on 9/19/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

22 Terms

1
New cards

Complete the code that returns all businesses whose name contains "Tea". business.____("Business", ____.____("Tea"))

where, are, containing

2
New cards
Complete the code that returns shows with:

a rating of at least 8
at least 6 seasons

tv_shows.____(
    "Rating", ____.____(8)
).____(
    "# of Seasons", ____.____(6)
)


where, are, above_or_equal_to, where, are, above_or_equal_to

3
New cards

Complete the expression that returns only "Business" and "Minutes" for businesses in "Southside" at least 11 minutes away:

business.____(

"Neighborhood", "Southside"

).____(

"Minutes", ____.____(11)

).____(

"Business", "Minutes"

)

where, where, are, above_or_equal_to, select

4
New cards

Complete the code that determines how many seasons the highest-rated show has:

tv_shows.____(

"Rating", ____=____

).____(

"# of Seasons"

).____(0)

sort, descending, True, column, item

5
New cards

Complete the code that returns a table containing the 5 highest-rated shows:

shows.____(

"Rating", ____=____

).____(

________(5)

)

sort, descending, True, take, np.arange

6
New cards

Complete the code that returns an array containing the names of the 5 highest-rated shows:

shows.____(
"Rating", ____=____
).____(
________(5)
).____(
"Name"
)


sort, descending, True, take, np.arange, column

7
New cards
def is_nearby(minutes):
    return minutes <= 12

Complete the code that applies this function to every business:

business.____(

____, "Minutes"

)

apply, is_nearby

8
New cards

Given:

def end_year(premiere_year, num_seasons):

return premiere_year + num_seasons

Complete:

tv_shows.____(
    ____,
    "Premiere Year",
    "# of Seasons"
)


apply, end_year

9
New cards

Complete the code that calculates the average satisfaction of "Sweet" pastries:

________(

pastries.____(

"category", "Sweet"

).____(

"satisfaction"

)

)

np.average, where, column

10
New cards

Complete the expression that calculates satisfaction ÷ price for every pastry:

pastries.____("satisfaction") / pastries.____("price")

column, column

11
New cards

You already created the array score_array. Complete the code that adds it to pastries under the column name "satisfaction per $":

pastries = pastries.____(

"satisfaction per $", ____

)

with_column, score_array

12
New cards

Given: def score(satisfaction, price):

return satisfaction / price

Complete the expression that calculates a score for every pastry:

pastries.____(

____,

"satisfaction",

"price"

)

apply, score

13
New cards

Complete the code that returns an array of the item names of the 3 pastries with the highest "satisfaction per $":

pastries.____(

"satisfaction per $", ____=____

).____(

____.____(3)

).____(

"item"

)

sort, descending, True, take, np, arange, column

14
New cards

Complete the code that finds the average age for each player position:

players.____(

"Position", "Age"

).____(

"Position", ____.____

)

select, group, np average

15
New cards

Complete the code to find the 5 non-highway intersections with the most crashes:

no_highway = berkeley.____(

"Highway", False

).____(

make_array("Road 1", "Road 2")

)

top_five = no_highway.____(

"count", ____=____

).____(

________(5)

)

where, group, sort, descending, True, take, np.arange

16
New cards

Complete the code to compare crash counts by "Time" for each "Day of Week":

berkeley.pivot(

"Time", "Day of Week"

).____(

"Day of Week"

)

barh

17
New cards

Complete the code that plots the average Project and Final scores for each enrollment week:

scores.____(

"Enrolled", ____.____

).____(

"Enrolled"

)

group, np, average, barh

18
New cards

Complete the code that visualizes the distribution of "Homeless per 10,000":

fifty_states.____(

"Homeless per 10,000"

)

hist

19
New cards

Complete the function that converts "Minutes" and "Seconds" from a row into total seconds:

def total_seconds(row):

return 60 * row.____("Minutes") + row.____("Seconds")

item, item

20
New cards

Complete the code so the resulting array is: 3, 5, 7, 9

np.arange(____, ____, ____)

3, 11, 2

21
New cards

Complete the expression that returns the first 4 rows of restaurants:

restaurants.____(

________(4)

)

take, np.arange

22
New cards

Complete the code that returns an array containing the names of the 3 highest-rated restaurants in "Downtown":

restaurants.____(

"Neighborhood", "Downtown"

).____(

"Rating", ____=____

).____(

________(3)

).____(

"Name"

)

where, sort, descending, True, take, np.arange, column