API CAN CODE �Computational Foundations of �Data Science
Lesson 2.5: Preparing Data for Analysis
This work was made possible through generous support from the National Science Foundation (Award # 2141655).
2.4 Recap
2
Warmup
3
Finding the Billboard Hot 100
4
Getting Example Code
Once subscribed, go to the right side (look for “Code Snippets”): �make sure the “Target” reads “Python” and the “Client” reads “Requests”.
Be sure you’ve selected the right endpoint� (on the left!): “Hot 100”
5
Request from EduBlocks
6
Offline API Backup!
7
Preview the Data
What variables are present? What kind of data is stored?�
What questions do you have about the data?
8
Explore the Data
Modify your code so that it lists just the artists in the dataset. Do you recognize any artists in the list?�
How many Taylor Swift songs are in this list? (Write a loop that counts for you!)�
Choose an artist and write an if statement to check if there are any songs by that artist in the dataset.
9
Explore the Data
Some songs feature multiple artists working in collaboration! �
The code to the right will check the entire list of artists to see if the list contains a particular artist name. �
Consider using this snippet of code as we move into your own independent investigations!
10
Investigate!
Formulate a question of interest about the Billboard 100 data and answer it! You might use for loops or conditional if statements like we used for the Movie investigation.�
Here, you may choose any artist you want (or other search criteria if you can find something of interest!)
You might also want data from another week; think about what statements you could add to your program to draw in data from other weeks!�
11
Share Your Investigation Results!
12
Exporting Data from EduBlocks
13
Importing Data into CODAP
14
Importing Data into CODAP
15
There’s a quick guide in your handouts for future use!
Upcoming work with CODAP
16
Thanks!
apicancode@umd.edu
17
This work was made possible through generous support from the National Science Foundation (Award # 2141655).
API Can Code is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike
4.0 International (CC BY-NC-SA 4.0) License