November 22, 2022

10 min read

City Level Demographic Insights in 3 Steps via the Parcl Labs API

The Parcl Labs API contains several enrichment layers that can be used to derive actionable insights about any market, at any level of geography. One of these layers is demographic data: such as income, occupation, and educational attainment information, and in this blog we zoom in on population by generation in the Phoenix MSA. All demographic information available in the pilot API can be accessed today, for free, in three easy steps:

  1. Register for the API
  2. Define the GraphQL query
  3. Call the API and visualize the results

Step 1: Register for the API

If you haven’t registered for the API, check out our first blog which teaches you the basics of querying the Parcl Labs Price Feed or click the button below. If you’ve already registered, move on the step 2!

After you register you will receive an API key giving you access to the Parcl Labs API. The Parcl Labs API leverages GraphQL to give you access to real time real estate data, demographic data and geospatial data to empower users to perform accurate and timely real estate analysis. If you are not familiar with the Parcl Labs API or GraphQL, you can read our documentation to learn more.

You can retrieve API data with only a couple lines of GraphQL code. For demonstration purposes here we will show you a use case using Python, one of the most popular programming languages for data analysis, but the API can be used in combination with your favorite tech stack. Once you’ve received your key, you can store it as a variable in Python along with the API endpoint URL:

Step 2: Define the GraphQL query

In this example we will look into leveraging the API to understand the demographic breakdowns of the Phoenix Metropolitan Area. Demographic insights can be layered on to real estate pricing to uncover trends that price alone cannot display. First we name our query, in this case PHX_DEMOGRAPHICS, and then we can query all cities within the “Phoenix-Mesa-Chandler, AZ” MSA from the CITY table (see the Parcl Labs API docs for a comprehensive list of geographies and objects available in the API).

After defining the MSA, the columns we output from the CITY table are CITY_NAME and PARCL_ID (our unique identifier of different levels of geography). Within the CITY geographies is a nested table, census, containing the demographic data. In the example below we query census at the geography we defined with a parameter of year equal to 2020 (there are census values for every year and we only want one population value for each category). Finally we can choose the variables to pull from census, in this case: total population, male and female baby boomer population, male and female GenZ population, and male and female millennial population. This is what the query would look like:

Step 3: Call the API and visualize the results 

Once you have plugged in your query, the URL and API key you can call the API with Python:

The next step is to flatten the JSON response into a dataframe and aggregate the demographic columns to drill into population by generation:

And finally visualize it with your choice of visualization libraries, here we use Plotly:

Based on our parameters, this outputs a bar chart showing the population by generation at the city level for the 10 most populous cities in the Phoenix MSA. This allows us to understand age and population distribution in the Phoenix market, with all data coming from the Parcl Labs API.

Pilot API data is currently in beta and may not exactly match our published content.

Several cities are trending younger, with Gen Z and Millennials populations outpacing Boomers in Phoenix, and Gen Z being the most populous group in both Gilbert and Glendale. On the other hand we see a much older population in the data in a place like Scottsdale. While this distribution is interesting at face value, the true value of demographic data is unlocked when combined with real time real estate insights, such as our proprietary Parcl Labs Price Feed (PLPF). These intersections can give buyers, investors and developers insights into the evolution of a market, not only where it’s been but also where it’s going. We will explore this intersection and how to get there in the next use case blog.

You can register here for early access to our API and start getting insights into your markets well ahead of others.

Check out the full notebook to run this code yourself!

Disclaimer: The material contained on this website is provided for educational and informational purposes only, without any express or implied warranty of any kind. The information on this website does not constitute the provision of investment, tax, legal or other professional advice. No reliance may be placed for any purpose on the information and opinions contained herein or their accuracy or completeness, and nothing contained herein may be relied upon in making any investment decision.

Subscribe to our newsletter
Read about our privacy policy.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Share this post