Compare construction spending by building use in Python

Compare annual manufacturing, commercial and residential construction spending using Census C30 monthly flows.

Compare spending across construction markets

A building-material supplier wants to compare the national markets for manufacturing facilities, commercial buildings and residential construction. This example calculates 2024 and 2025 spending from twelve unadjusted monthly observations, then compares the annual totals. It uses private construction throughout so the ownership basis stays consistent.

The optional input.csv contains three genuine category selections: manufacturing, commercial including farm buildings, and residential including improvements. The same choices appear in the selections list in the Python code below. No projects or observations are invented.

Download monthly_observations.csv into your working folder. It is a genuine subset of the purchased table: 144 records for those categories in 2024–2025, with both adjusted annualized rates and unadjusted monthly flows. All 23 fields are unchanged. The full $29 edition contains 142,560 monthly records across 360 series, plus eleven supporting CSV tables. Inspect the complete product.

Code example

Run this standard-library code in a notebook cell, IPython or a script. It selects NSA monthly flows, requires twelve reported months for each year, and prints three annual comparisons. Summing the SAAR column would add twelve annualized rates and give the wrong annual amount.

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
import csv
from decimal import Decimal

# Real category choices, also provided in the optional input.csv on the guide page.
selections = [
    {'group_code': 'PRIVATE:manufacturing'},
    {'group_code': 'PRIVATE:commercial_inc_farm'},
    {'group_code': 'PRIVATE:residential_inc_improvements'},
]
start_year, end_year = '2024', '2025'
selected = {row['group_code'] for row in selections}
observations = {}
with open('monthly_observations.csv', newline='', encoding='utf-8') as f:
    for row in csv.DictReader(f):
        if row['group_code'] not in selected or row['seasonal'] != 'NSA' or row['year'] not in {start_year, end_year}:
            continue
        key = row['group_code'], row['month']
        if key in observations:
            raise ValueError('Duplicate observation: ' + str(key))
        if row['availability'] != 'reported' or row['period_basis'] != 'monthly_flow':
            raise ValueError('Unavailable value or incompatible period basis: ' + str(key))
        observations[key] = row

results = []
for selection in selections:
    group = selection['group_code']
    annual = {}
    for year in (start_year, end_year):
        keys = [(group, f'{year}-{month:02}') for month in range(1, 13)]
        if any(key not in observations for key in keys):
            raise ValueError('Twelve complete monthly values are required: ' + group)
        annual[year] = sum(Decimal(observations[key]['value']) for key in keys)
    if annual[start_year] <= 0:
        raise ValueError('Growth requires a positive starting value')
    growth = 100 * (annual[end_year] / annual[start_year] - 1)
    name = observations[group, end_year + '-12']['category_name']
    results.append(dict(group_code=group, category_name=name,
                        start_year=start_year, end_year=end_year,
                        start_million_usd=str(annual[start_year]),
                        end_million_usd=str(annual[end_year]), change_percent=f'{growth:.2f}'))
    print(f'{name}: {start_year} ${annual[start_year]/1000:,.2f} billion; '
          f'{end_year} ${annual[end_year]/1000:,.2f} billion; change {growth:+.2f}%.')

Analysis of the output

Manufacturing: 2024 $243.35 billion; 2025 $213.82 billion; change -12.14%.
Commercial (inc. Farm): 2024 $131.07 billion; 2025 $122.48 billion; change -6.55%.
Residential (inc. Improvements): 2024 $933.74 billion; 2025 $923.44 billion; change -1.10%.

Private manufacturing construction declined from $243.35 billion in 2024 to $213.82 billion in 2025, a 12.14% decrease. Commercial construction declined 6.55%, while residential construction declined 1.10%. This gives the supplier a consistent national comparison across three different end-use markets.

These are nominal spending changes: they combine changes in prices and the amount or mix of construction. They do not establish real growth, profitability, demand for a particular supplier, or statistical significance. Manufacturing here means construction of manufacturing facilities, not the value of manufactured goods.

The totals are sums of rounded monthly values. Census’s separately published annual estimates can differ slightly; annual_checks.csv reconciles the mapped totals. The construction collection adds related payroll, price and local housing context while explaining where definitions and geography differ.

Using the full dataset

Extract the purchased ZIP and replace the sample with its complete monthly_observations.csv. The code runs unchanged. Change selections, start_year and end_year to examine other categories and periods. The main observation key is series_id + month; group_code identifies ownership and construction end use.

groups.csv lists the 180 groups and their hierarchy. These are construction end uses, not contractor NAICS industries. Do not add a parent category to its children or add total construction to private and public spending. State/local refers to project ownership; the estimates are national.

series.csv and coverage.csv show available periods. Before 2002, detailed TOTAL, PUBLIC and FEDERAL cells that Excel hides as zero are explicitly marked unavailable. Data centers begin in 2014 and were previously included in general office. Private residential-improvement coverage also changed in 2008. Missing values and these coverage breaks require attention when changing the example’s dates.

annual_sums.csv contains complete-year NSA sums. published_annual.csv retains Census’s 2022–2025 annual estimates, including extra annual detail; not every category has a reviewed monthly counterpart. annual_uncertainty.csv retains 2025 coefficients of variation and percent-change standard errors. Read the statistic and unit before using them; earlier uncertainty is not supplied.

ownership_checks.csv flags 19 TOTAL SAAR comparisons in 2004–2005 that exceed whole-million rounding bounds. The original values remain unchanged, and their cause is not established. The source notes, dictionaries and coordinates let you inspect the relevant workbooks. The annual NSA comparisons in this example are within their rounding bounds.

Sources and versions

Source: Census Construction Spending (C30) workbooks, November 2, 2026 monthly release, retained November 8, 2026 UTC. Monthly scope is January 1993–December 2025 as revised in this edition; partial 2026 is excluded. Published annual tables cover 2022–2025 and their uncertainty tables cover 2025.

The source definitions explain value of construction put in place and end-use categories. Construction spending includes new structures and improvements but excludes land and maintenance. Current reclassified history should not be spliced to old pre-June-2003 classification tables.

Census provides the workbooks free. ACD sells preparation, checks, documentation and delivery. Processing improvements and publisher error corrections to the purchased edition are included; routine new source editions and reporting periods may be separate purchases. Read the source and preparation record.

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