Classwork 11

Data Collection with APIs

Author

Byeong-Hak Choe

Published

April 9, 2025

Modified

April 14, 2025

Question 1

Provide a Python code to get New York City air quality surveillance data using the following API endpoint:

https://data.cityofnewyork.us/resource/c3uy-2p5r.json

  • Use the following query parameter dictionary in your request, which sets the “$limit” to control how many rows are returned:
# query parameters (e.g., limit rows)
param_dict = {
    "$limit": 100   # You can increase this to get more observations
}

Answer:



Question 2

  • Use the FRED API to retrieve two macroeconomic indicators:
    1. U.S. Real GDP (series_id = “GDPC1”)
    2. U.S. Unemployment Rate (series_id = “UNRATE”)
  • Then, use pandas to replicate the following DataFrame:



Answer:



Discussion

Welcome to our Classwork 11 Discussion Board! 👋

This space is designed for you to engage with your classmates about the material covered in Classwork 11.

Whether you are looking to delve deeper into the content, share insights, or have questions about the content, this is the perfect place for you.

If you have any specific questions for Byeong-Hak (@bcdanl) regarding the Classwork 11 materials or need clarification on any points, don’t hesitate to ask here.

Let’s collaborate and learn from each other!

Back to top