Compare Census tract rents and housing-cost burdens in Python

Look up median gross rent and renter cost burdens for Census tracts, with explicit denominators and margins of error.

Compare rent with the share of income spent on housing

A local market comparison needs more than a rent estimate. A tract with lower rents can still have a larger share of renters spending heavily on housing. This example adds median gross rent, housing-cost burden and uncertainty to three Census tract identifiers.

Download tract_housing.csv below. It is a genuine subset of the paid file: three tracts in Wake County, North Carolina, with all 70 product fields unchanged. Their identifiers appear in the tracts list in the Python code below. They are illustrative selections, not a ranking or a representative national sample.

The full $29 edition covers 85,382 tracts in the 50 states, DC and Puerto Rico. Six CSV tables include renter and owner burdens, mortgage subgroups, income brackets, original Census cells and coverage records. Inspect the full tract housing download.

Code example

Save the CSV in your working directory and run this code in a notebook cell, IPython or a Python script. It uses Python’s standard library. Keep the eleven-character GEOIDs as text.

Paths are relative to your working folder; use from pathlib import Path; print(Path.cwd()) to check it, or supply full paths.

Python 3.10+ · Jupyter, IPython or a script
"""Compare genuine Wake County tracts; runs in a notebook or as a script."""
import csv

tracts = ['37183050100', '37183050300', '37183050400']
results = []
with open('tract_housing.csv', encoding='utf-8', newline='') as source:
    for row in csv.DictReader(source):
        if row['tract_geoid'] not in tracts:
            continue
        results.append({key: row[key] for key in (
            'tract_geoid', 'median_gross_rent', 'median_gross_rent_moe_90',
            'median_gross_rent_status', 'median_gross_rent_moe_status',
            'renter_eligible_units', 'renter_not_computed_units',
            'renter_burdened_30plus_pct', 'renter_burdened_30plus_pct_moe_90',
            'renter_burdened_30plus_pct_status', 'renter_burdened_30plus_pct_moe_status',
            'renter_severely_burdened_50plus_pct')})
if {row['tract_geoid'] for row in results} != set(tracts):
    raise ValueError('One or more selected tracts are absent from this file.')
for row in results:
    rent = row['median_gross_rent'] or row['median_gross_rent_status']
    rent_moe = row['median_gross_rent_moe_90'] or row['median_gross_rent_moe_status']
    burden = row['renter_burdened_30plus_pct']
    burden = f"{float(burden):.1f}%" if burden else row['renter_burdened_30plus_pct_status']
    moe = row['renter_burdened_30plus_pct_moe_90']
    moe = f"{float(moe):.1f} pp" if moe else row['renter_burdened_30plus_pct_moe_status']
    print(f"{row['tract_geoid']} | median rent ${rent} ± ${rent_moe} | "
          f"rent burden {burden} ± {moe} | "
          f"computed-ratio units {row['renter_eligible_units']} | "
          f"not computed {row['renter_not_computed_units']}")

Analysis of the output

37183050100 | median rent $1919 ± $109 | rent burden 36.2% ± 8.9 pp | computed-ratio units 2863 | not computed 22
37183050300 | median rent $1741 ± $128 | rent burden 47.0% ± 8.6 pp | computed-ratio units 1643 | not computed 0
37183050400 | median rent $1308 ± $145 | rent burden 29.7% ± 11.7 pp | computed-ratio units 303 | not computed 6

Tract 501 has an estimated median gross rent of $1,919, compared with $1,741 in tract 503. Yet the estimated share of renters spending at least 30% of income on housing is lower in tract 501: 36.2%, compared with 47.0% in tract 503. The measures answer different questions: rent describes monthly housing costs, while burden also reflects household income. These are 2020–2024 survey estimates in 2024 dollars, not current asking rents.

The ± values are 90% margins of error. Rent uses the published margin; burden uses an approximation calculated from Census count margins. The burden intervals for tracts 501 and 503 overlap, so this comparison does not establish a statistically significant difference. Tract 504 has only 303 renter units with a computed cost/income ratio and a relatively wide margin around its burden estimate. Keep uncertainty beside the figures when presenting a local comparison.

The denominator is renters for whom Census computed a housing-cost-to-income ratio. The printed excluded count shows households without that ratio; they are not assigned zero burden. The 50%-plus measure identifies a subset of the 30%-plus group. Do not add those percentages together.

Using the full dataset

Extract the purchased archive and replace the sample with the full tract_housing.csv; the code runs unchanged. Edit tracts for your own locations. For a larger table, join on tract_geoid using compatible 2024 Census geography. The main file has one row per tract, including county and state identifiers.

cost_burden.csv contains four cohorts per tract: renters, all owners, owners with a mortgage and owners without one. Select a cohort before joining. The owner total overlaps the two mortgage subgroups. income_burden.csv separates renters and owners into five positive-income brackets and gives each bracket’s 30%-plus burden measure. Its denominators differ from the overall ratio-computed denominator.

source_cells.csv preserves all 81 estimate/MOE pairs per tract, original annotations, labels and source variables. It has millions of rows; stream or filter it rather than opening it in Excel. county_coverage.csv and source_accounting.csv account for the geographic inventory and captured responses. Dictionaries explain every field.

Missing estimates and missing uncertainty have separate status fields. A blank value is not zero. Open-ended median rent values remain annotated rather than becoming point estimates. Do not sum medians or average tract percentages to construct county or ZIP statistics.

The tract demographic profile can add population and household-income context on the same 2024 tract keys. The county housing reference supplies directly published county inputs when county comparisons are the goal. A postal ZIP/tract relationship can identify related areas, but address shares are not weights for deriving a ZIP median or affordability rate. Each companion is sold separately. Browse the housing collection or geography collection for the relevant starting point.

Sources and versions

The free original source is the Census Bureau’s 2020–2024 ACS five-year Detailed Tables: B25064, B25070, B25091 and B25106. Census released this edition on January 29, 2026; ACD retained the responses and definitions on November 12, 2026 UTC. The geographic inventory includes Puerto Rico and Connecticut’s planning-region county structure.

ACD prepares documented CSVs, explicit denominators, preserved source annotations and calculated uncertainty. Independent checks reconcile the delivered files with the original responses. Retained source, staging and preparation layers make the edition reproducible without reacquiring the source.

The source and preparation record distinguishes Census’s source edition from ACD’s processing revision. Improvements and documented publisher error corrections to the purchased edition are included. A later source edition is a separate purchase.

Example checked November 12, 2026 against both these samples and the complete purchased files. Source and processing records, sample checksums · Expected result CSV. Independent preparation; no agency endorsement.