Seven moves: practice
Here are a series of practice questions if you'd like to drill what you learned above. These are completely optional. If you get a question wrong it will ask you again later in the sequence.
Name the moveYou missed this one earlier. Try it again.
Here is schools before and after one move.
| school | district | students | absent |
|---|---|---|---|
| Adams | North | 400 | 60 |
| Baker | North | 250 | 50 |
| Cole | North | 150 | 45 |
| Diaz | South | 600 | 60 |
| Evans | South | 100 | 30 |
| Ford | East | 300 | 75 |
| Grant | East | 200 | NaN |
| Hale | NaN | 350 | 70 |
After
| school | district | students | absent |
|---|---|---|---|
| Adams | North | 400 | 60 |
| Baker | North | 250 | 50 |
| Cole | North | 150 | 45 |
Which move turned the first table into the last one?
PredictYou missed this one earlier. Try it again.
| clinic | county | visits | staff |
|---|---|---|---|
| Ash | West | 120 | 4 |
| Birch | West | 80 | 2 |
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
| Oak | North | 60 | 2 |
clinics[clinics["visits"] > 100]Predict: how many rows will come out?
Name the moveYou missed this one earlier. Try it again.
Here is schools before and after one move.
| school | district | students | absent |
|---|---|---|---|
| Adams | North | 400 | 60 |
| Baker | North | 250 | 50 |
| Cole | North | 150 | 45 |
| Diaz | South | 600 | 60 |
| Evans | South | 100 | 30 |
| Ford | East | 300 | 75 |
| Grant | East | 200 | NaN |
| Hale | NaN | 350 | 70 |
After
| school | absent |
|---|---|
| Adams | 60 |
| Baker | 50 |
| Cole | 45 |
| Diaz | 60 |
| Evans | 30 |
| Ford | 75 |
| Grant | NaN |
| Hale | 70 |
Which move turned the first table into the last one?
Pick the codeYou missed this one earlier. Try it again.
“Keep only the clinics in East county.”
| clinic | county | visits | staff |
|---|---|---|---|
| Ash | West | 120 | 4 |
| Birch | West | 80 | 2 |
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
| Oak | North | 60 | 2 |
The result should look like this
| clinic | county | visits | staff |
|---|---|---|---|
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
Which line produces that result?
Name the moveYou missed this one earlier. Try it again.
Here is clinics before and after one move.
| clinic | county | visits | staff |
|---|---|---|---|
| Ash | West | 120 | 4 |
| Birch | West | 80 | 2 |
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
| Oak | North | 60 | 2 |
After
| clinic | county | visits | staff |
|---|---|---|---|
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Ash | West | 120 | 4 |
| Fir | East | 100 | 4 |
| Birch | West | 80 | 2 |
| Oak | North | 60 | 2 |
Which move turned the first table into the last one?
PredictYou missed this one earlier. Try it again.
| clinic | county | visits | staff |
|---|---|---|---|
| Ash | West | 120 | 4 |
| Birch | West | 80 | 2 |
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
| Oak | North | 60 | 2 |
clinics.sort_values("visits")Predict: which clinic will be in the first row?
Name the moveYou missed this one earlier. Try it again.
Here is clinics before and after one move.
| clinic | county | visits | staff |
|---|---|---|---|
| Ash | West | 120 | 4 |
| Birch | West | 80 | 2 |
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
| Oak | North | 60 | 2 |
After
| clinic | county | visits | staff | visits_per_staff |
|---|---|---|---|---|
| Ash | West | 120 | 4 | 30 |
| Birch | West | 80 | 2 | 40 |
| Cedar | East | 200 | 5 | 40 |
| Elm | East | 150 | 3 | 50 |
| Fir | East | 100 | 4 | 25 |
| Oak | North | 60 | 2 | 30 |
Which move turned the first table into the last one?
PredictYou missed this one earlier. Try it again.
| clinic | county | visits | staff |
|---|---|---|---|
| Ash | West | 120 | 4 |
| Birch | West | 80 | 2 |
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
| Oak | North | 60 | 2 |
clinics["visits_per_staff"] = clinics["visits"] / clinics["staff"]Predict: what will Cedar's visits_per_staff be?
Pick the codeYou missed this one earlier. Try it again.
“Show just each clinic's name and county.”
| clinic | county | visits | staff |
|---|---|---|---|
| Ash | West | 120 | 4 |
| Birch | West | 80 | 2 |
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
| Oak | North | 60 | 2 |
The result should look like this
| clinic | county |
|---|---|
| Ash | West |
| Birch | West |
| Cedar | East |
| Elm | East |
| Fir | East |
| Oak | North |
Which line produces that result?
Name the moveYou missed this one earlier. Try it again.
Here is schools before and after one move.
| school | district | students | absent |
|---|---|---|---|
| Adams | North | 400 | 60 |
| Baker | North | 250 | 50 |
| Cole | North | 150 | 45 |
| Diaz | South | 600 | 60 |
| Evans | South | 100 | 30 |
| Ford | East | 300 | 75 |
| Grant | East | 200 | NaN |
| Hale | NaN | 350 | 70 |
After
| district | students |
|---|---|
| East | 300 |
| North | 400 |
| South | 600 |
Which move turned the first table into the last one?
PredictYou missed this one earlier. Try it again.
| clinic | county | visits | staff |
|---|---|---|---|
| Ash | West | 120 | 4 |
| Birch | West | 80 | 2 |
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
| Oak | North | 60 | 2 |
clinics.groupby("county")["visits"].sum()Predict: how many rows will come out?
PredictYou missed this one earlier. Try it again.
| clinic | county | visits | staff |
|---|---|---|---|
| Ash | West | 120 | 4 |
| Birch | West | 80 | 2 |
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
| Oak | North | 60 | 2 |
clinics.groupby("county")["visits"].sum()Predict: what will East's value in the result be?
Name the moveYou missed this one earlier. Try it again.
Here is clinics, a second table county_pop, and the result of one move.
| clinic | county | visits | staff |
|---|---|---|---|
| Ash | West | 120 | 4 |
| Birch | West | 80 | 2 |
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
| Oak | North | 60 | 2 |
| county | population |
|---|---|
| West | 50,000 |
| East | 80,000 |
| North | 30,000 |
| South | 40,000 |
After
| clinic | county | visits | staff | population |
|---|---|---|---|---|
| Ash | West | 120 | 4 | 50,000 |
| Birch | West | 80 | 2 | 50,000 |
| Cedar | East | 200 | 5 | 80,000 |
| Elm | East | 150 | 3 | 80,000 |
| Fir | East | 100 | 4 | 80,000 |
| Oak | North | 60 | 2 | 30,000 |
Which move turned the first table into the last one?
PredictYou missed this one earlier. Try it again.
| school | district | students | absent |
|---|---|---|---|
| Adams | North | 400 | 60 |
| Baker | North | 250 | 50 |
| Cole | North | 150 | 45 |
| Diaz | South | 600 | 60 |
| Evans | South | 100 | 30 |
| Ford | East | 300 | 75 |
| Grant | East | 200 | NaN |
| Hale | NaN | 350 | 70 |
| district | year | per_pupil |
|---|---|---|
| North | 2025 | 12,000 |
| South | 2024 | 9,500 |
| South | 2025 | 9,800 |
| East | 2025 | 10,200 |
schools.merge(funding[funding["year"] == 2025], on="district", how="left")funding[funding["year"] == 2025], inside the parentheses, is itself a move.
Predict: how many rows will come out?
Name the moveYou missed this one earlier. Try it again.
Here is clinics before and after one move.
| clinic | county | visits | staff |
|---|---|---|---|
| Ash | West | 120 | 4 |
| Birch | West | 80 | 2 |
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
| Oak | North | 60 | 2 |
After
| clinic | county | variable | value |
|---|---|---|---|
| Ash | West | visits | 120 |
| Birch | West | visits | 80 |
| Cedar | East | visits | 200 |
| Elm | East | visits | 150 |
| Fir | East | visits | 100 |
| Oak | North | visits | 60 |
| Ash | West | staff | 4 |
| Birch | West | staff | 2 |
| Cedar | East | staff | 5 |
| Elm | East | staff | 3 |
| Fir | East | staff | 4 |
| Oak | North | staff | 2 |
Which move turned the first table into the last one?
PredictYou missed this one earlier. Try it again.
| clinic | county | visits | staff |
|---|---|---|---|
| Ash | West | 120 | 4 |
| Birch | West | 80 | 2 |
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
| Oak | North | 60 | 2 |
clinics.melt(id_vars=["clinic", "county"], value_vars=["visits", "staff"])Predict: after this line, what does one row represent?
PredictYou missed this one earlier. Try it again.
| county | population |
|---|---|
| West | 50,000 |
| East | 80,000 |
| North | 30,000 |
| South | 40,000 |
| clinic | county | visits | staff |
|---|---|---|---|
| Ash | West | 120 | 4 |
| Birch | West | 80 | 2 |
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
| Oak | North | 60 | 2 |
county_pop.merge(clinics, on="county", how="left")Predict: how many rows will come out?
Pick the codeYou missed this one earlier. Try it again.
“Calculate each clinic's visits per staff member.”
| clinic | county | visits | staff |
|---|---|---|---|
| Ash | West | 120 | 4 |
| Birch | West | 80 | 2 |
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
| Oak | North | 60 | 2 |
The result should look like this
| clinic | county | visits | staff | visits_per_staff |
|---|---|---|---|---|
| Ash | West | 120 | 4 | 30 |
| Birch | West | 80 | 2 | 40 |
| Cedar | East | 200 | 5 | 40 |
| Elm | East | 150 | 3 | 50 |
| Fir | East | 100 | 4 | 25 |
| Oak | North | 60 | 2 | 30 |
Which line produces that result?
Pick the codeYou missed this one earlier. Try it again.
“Find the largest number of visits at any clinic in each county.”
| clinic | county | visits | staff |
|---|---|---|---|
| Ash | West | 120 | 4 |
| Birch | West | 80 | 2 |
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
| Oak | North | 60 | 2 |
The result should look like this
| county | visits |
|---|---|
| East | 200 |
| North | 60 |
| West | 120 |
Which line produces that result?
Pick the codeYou missed this one earlier. Try it again.
“List the East clinics from most visits to fewest.”
| clinic | county | visits | staff |
|---|---|---|---|
| Ash | West | 120 | 4 |
| Birch | West | 80 | 2 |
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
| Oak | North | 60 | 2 |
The result should look like this
| clinic | county | visits | staff |
|---|---|---|---|
| Cedar | East | 200 | 5 |
| Elm | East | 150 | 3 |
| Fir | East | 100 | 4 |
Which line produces that result?