Arrange
Exercise 1:
Modify the code below to arrange by artist name in descending order.
hint
You can sort something in descending order, using the
-
operator.
another hint
Start by using the pipe operator with
arrange()
. You will need to specify what to arrange by.
country | position | track_name | artist | streams | duration | continent | |
---|---|---|---|---|---|---|---|
0 | Argentina | 1 | Tusa | KAROL G | 1858666 | 200.960 | Americas |
1 | Argentina | 2 | Tattoo | Rauw Alejandro | 1344382 | 202.887 | Americas |
2 | Argentina | 3 | Hola - Remix | Dalex | 1330011 | 249.520 | Americas |
... | ... | ... | ... | ... | ... | ... | ... |
12397 | South Africa | 198 | Black And White | Niall Horan | 11771 | 193.090 | Africa |
12398 | South Africa | 199 | When I See U | Fantasia | 11752 | 217.347 | Africa |
12399 | South Africa | 200 | Psycho! | MASN | 11743 | 197.217 | Africa |
12400 rows × 7 columns
What artist is the last observation (row) in the result?
(click to answer)
Exercise 2:
What is the first track, if you filter to keep only observations from the country Mexico, and then sort in ascending order by track name?
⚠️: Don't forget to replace all the blanks!
(click to answer)
Exercise 3:
Below is code with the arrange verb removed. Modify it to arrange in ascending order..
- first by position
- second by streams
⚠️: Don't forget to replace all the blanks!
What country has the position 1 track (The Box) with fewest streams?
(click to answer)
Exercise 4
What's the shortest song in the top position in the music_top200
data?
(click to answer)