1. Learn
  2. /
  3. Courses
  4. /
  5. Analyzing US Census Data in Python

Exercise

Congressional Districts by State

A Pennsylvania-based family advocacy nonprofit wants to find the average family size by Congressional district, so that they can call representatives from districts with relatively large families. For this exercise you will have to know the GEOID (ANSI Code) for Pennsylvania. If you don't remember it from a previous exercise, use the Geographic Codes Lookup at the Missouri Census Data Center.

The requests and pandas (as pd) packages have been imported. The base_url is defined, as is the predicates dictionary with the list of variables to request.

Instructions 1/3

undefined XP
    1
    2
    3
  • Set the "for" key in the predicates dict to return all Congressional districts. Spell out congressional district in full.
  • Set the "in" key in the predicates dict to only return geographies in the state of Pennsylvania.