An interactive U.S. housing affordability data visualization dashboard with two different designs.
DATA511 project/
├── app.py # Main application entry (includes navigation)
├── pages/
│ ├── intro.py # Introduction page
│ ├── design1.py # Design 1: Interactive Map Explorer
│ └── design2.py # Design 2: Time Series Comparison
├── desgin1/ # Design 1 source code and data
│ ├── app.py
│ ├── charts.py
│ ├── config_data.py
│ ├── geo_utils.py
│ ├── events.py
│ └── data/
│ ├── house_ts_agg.csv
│ ├── cbsa_shapes.zip
│ └── zcta_shapes.zip
├── design2/ # Design 2 source code and data
│ ├── design2.py
│ ├── home.py
│ └── HouseTS.csv
└── requirements.txt # Project dependencies
pip install -r requirements.txtstreamlit run app.pyThe application will open in your browser at http://localhost:8501 by default.
- Project introduction
- Description of the two designs
- Price-to-Income Ratio (PTI) calculation method
- References
Key Features:
- Metro-level Visualization: Interactive choropleth map
- Drill-down Functionality: Drill down from Metro areas to ZIP codes
- Multiple Metrics: Price-to-Income Ratio (PTI) and median sale price
- Historical Trends: Time series analysis for individual ZIP codes
- Geographic Exploration: Clickable map
How to Use:
- Use the control panel at the top to select year and metric
- Click on Metro areas on the map to view ZIP code details
- Click on ZIP codes to view detailed metrics and historical trends
Key Features:
- Multi-city Comparison: Time series comparison of price-to-income ratios
- Affordability Level Visualization: Color-coded level bands
- Interactive Selection: Select multiple metropolitan areas
- Annual Analysis: Yearly changes from 2012-2023
How to Use:
- Select metropolitan areas to compare in the left panel
- Charts will automatically update to show selected cities
- Hover to view detailed data
- HouseTS Dataset: From Kaggle, containing data for 30 major U.S. metropolitan areas from 2012-2023
- Shapefiles: CBSA and ZCTA boundary data for map visualization
Price-to-Income Ratio (PTI)
PTI = median_sale_price / (per_capita_income × 2.51)
Where 2.51 is the median U.S. household size.
Affordability Levels:
- 0.0-3.0: Affordable 🟢
- 3.1-4.0: Moderately Unaffordable 🟡
- 4.1-5.0: Seriously Unaffordable 🟠
- 5.1-8.9: Severely Unaffordable 🔴
- 9.0+: Impossibly Unaffordable ⚫
- Streamlit: Web application framework
- Plotly: Interactive charts and maps
- GeoPandas: Geospatial data processing
- Pandas: Data processing
- NumPy: Numerical computation
- Dataset: shengkunwang. (2025). HouseTS Dataset. Kaggle
- Affordability Levels: Cox, Wendell (2025). Demographia International Housing Affordability, 2025 Edition. Center for Demographics and Policy
- Ensure
desgin1/data/house_ts_agg.csvfile exists - Check if shapefile ZIP files are complete
- Ensure
design2/HouseTS.csvfile exists - Check if the file path is correct
- Ensure all dependencies are installed (especially geopandas and shapely)
- Check if shapefile files are complete
- Design 1 requires significant memory to process geospatial data
- Initial map loading may take some time
- A modern browser is recommended for the best experience