This is a project to generate visualizations specifically for California 100's regional reports. We will create 9 regional demographic pyramid visualizations using the latest year from the US Census (ACS5) data (2020).
A population pyramid is a common socioeconomic data visualization to understand the age and gender distribution of a geographic region.
For this project, we will generate a more detailed demographic pyramid that displays the distribution of ethnicity for each age demographic. This was inspired by this project.
- Install Python
This project has 2 ways to generate the pyramid. If you just want to generate the pyramid, please use the Hassle-Free Way. If you wish to be more interactive, understand the code, and make customizations, use the Interactive Way.
The Interactive Way is through a Jupyter notebook with descriptions of the code and its processes. If you wish to make any changes such as changing the colors or labels, please use this way.
- Open terminal on Mac or PC
- Open the folder with the code in your finder
- Follow the instructions to copy the file path of your folder
- In your terminal, type in
cd
then what you copied from step 3. Example:cd /Users/danielhuang/Documents/CA100/code
- Run
python demographic_pyramid_generator.py
The notebook is divided into "cells" of individual code.
- Open terminal and run
jupyter notebook
- A tab should open in your browser with the url "localhost:8888". If the tab doesn't open, you can type in "localhost:8888" into the url manually.
- Run the entire notebook by pressing the "Play" button.
- You can run each cell by clicking the "Shift + Enter" keys.
- Run each cell. Later cells depend on the earlier cells, so while iPython allows you to run later cells, this may result in errors.