Compare ZIP-area language and English proficiency in Python

Join fictional service territories to genuine Census language and English proficiency estimates, retaining uncertainty and unmatched ZIPs.

Compare language needs across service areas

A service business has a list of postal ZIP codes and wants to understand the languages spoken in those areas. This reference adds Census estimates of language at home and English proficiency, alongside household measures that can inform further language-access research. It describes areas, not individual customers.

input.csv contains four fictional service territories. The same records appear in the territories list in the Python code below. The labels and ZIP selections illustrate the join; the Census figures are genuine.

Download zcta_language.csv below and save it in your working directory. This is a smaller version of the paid summary file: complete profiles for ZCTAs 01001, 10001 and 27513, with all 43 fields unchanged. The optional input CSV is also embedded in the code.

The full $29 edition covers 33,772 Census ZCTAs in five CSVs. It includes language profiles, 50 detailed categories per area, original counts and margins of error. The estimates describe 2020–2024.

Matching a postal ZIP to the identically numbered Census ZCTA supplies approximate area context. ZIP+4 inputs use only five digits. A match does not validate an address or establish nine-digit demographic precision.

Code example

This uses Python’s standard library and runs in a notebook, IPython or a script. It preserves input rows and prints three measures with approximate 90% margins of error in percentage points.

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 language and English proficiency in fictional service territories. Paste into a notebook or run as a script."""
import csv
import re
from collections import Counter

# These fictional service territories also appear in example_input.csv. They
# illustrate a ZIP join, not real customers or evidence of demand.
territories = [
    {'territory': 'A', 'postal_zip': '01001'},
    {'territory': 'B', 'postal_zip': '27513-1234'},
    {'territory': 'C', 'postal_zip': '10001'},
    {'territory': 'D', 'postal_zip': '00000'},
]


def normalize_zip(value):
    if value is None or isinstance(value, str) and not value.strip():
        return '', '', 'missing_input'
    if not isinstance(value, str):  # Never guess lost leading zeros.
        return '', '', 'invalid_format'
    code = value.strip()
    if re.fullmatch(r'[0-9]{5}', code):
        return code, 'zip5_as_supplied', ''
    if re.fullmatch(r'[0-9]{9}|[0-9]{5}-[0-9]{4}', code):
        return code[:5], 'zip_plus4_to_zip5', ''
    return '', '', 'invalid_format'


def load_profiles(filename):
    profiles = {}
    with open(filename, encoding='utf-8', newline='') as source:
        for row in csv.DictReader(source):
            code = row['zcta_code']
            if not re.fullmatch(r'[0-9]{5}', code) or code in profiles:
                raise ValueError('The reference must have one row per five-digit ZCTA.')
            profiles[code] = row
    return profiles


def enrich_territories(input_rows, profiles):
    output = []
    for order in input_rows:
        code, method, problem = normalize_zip(order['postal_zip'])
        area = profiles.get(code)
        status = problem or ('matched_zcta_code' if area is not None else 'no_zcta_match')
        row = {**order, 'zip5': code, 'normalization_method': method,
               'match_resolution': 'zip5' if code else '', 'match_status': status,
               'matched_zcta_code': code if area is not None else ''}
        for field in [name + suffix for name in ('spanish_at_home_pct', 'english_less_than_very_well_pct', 'limited_english_households_pct')
                      for suffix in ('', '_moe_90', '_status', '_moe_status')]:
            row['area_' + field] = area[field] if area is not None else ''
        output.append(row)
    return output


profiles = load_profiles('zcta_language.csv')
results = enrich_territories(territories, profiles)
assert len(results) == len(territories)  # A many-to-one join must preserve input rows.
def display_share(row, metric):
    stem = 'area_' + metric + '_pct'
    if not row[stem]:
        return row[stem + '_status']
    margin = row[stem + '_moe_90']
    uncertainty = f"± {float(margin):.1f} pp" if margin else row[stem + '_moe_status']
    return f"{float(row[stem]):.1f}% {uncertainty}"

for row in results:
    context = row['match_status']
    if context == 'matched_zcta_code':
        context = (f"ZCTA {row['matched_zcta_code']} | Spanish at home {display_share(row, 'spanish_at_home')} | "
                   f"English less than very well {display_share(row, 'english_less_than_very_well')} | "
                   f"limited-English households {display_share(row, 'limited_english_households')}")
    print(f"{row['territory']} | ZIP {row['postal_zip']} | {context}")
print('Input match coverage:', dict(Counter(row['match_status'] for row in results)))

# The first two percentages describe people age 5+, while the third describes
# households. MOEs are approximate 90% margins in percentage points. ZIP+4 uses
# only five digits. Area language estimates do not identify a customer's language
# or prove demand for translation, staffing or a particular service.

Analysis of the output

A | ZIP 01001 | ZCTA 01001 | Spanish at home 3.0% ± 1.6 pp | English less than very well 5.5% ± 2.2 pp | limited-English households 2.3% ± 1.5 pp
B | ZIP 27513-1234 | ZCTA 27513 | Spanish at home 6.8% ± 2.1 pp | English less than very well 6.2% ± 1.4 pp | limited-English households 2.3% ± 0.9 pp
C | ZIP 10001 | ZCTA 10001 | Spanish at home 9.9% ± 2.3 pp | English less than very well 8.2% ± 1.8 pp | limited-English households 4.8% ± 1.3 pp
D | ZIP 00000 | no_zcta_match
Input match coverage: {'matched_zcta_code': 3, 'no_zcta_match': 1}

Territory B retains its original ZIP+4 while matching ZCTA 27513 by its first five digits. An estimated 6.8% of residents age 5+ spoke Spanish at home, with an approximate margin of 2.1 percentage points. About 6.2% of residents age 5+ spoke English less than very well. Those are different questions: someone who speaks Spanish at home may also speak English very well.

The third measure describes households. About 2.3% of households in 27513 met Census’s limited-English-speaking definition: no member age 14+ spoke only English at home, or spoke another language and English very well. This does not mean that 2.3% of residents cannot speak English.

The example suggests questions for local research, such as which languages to consider when reviewing service information. It does not measure translation demand, identify anyone’s language, or test whether differences between areas are statistically significant. English proficiency is self-reported; “less than very well” includes responses of well, not well and not at all.

Keep margins beside comparisons. They describe sampling uncertainty, not postal-ZIP/ZCTA boundary differences. Territory D remains in the results with no_zcta_match because 00000 is absent from this reference. Missing measures and zero denominators retain explicit statuses instead of becoming false zeros.

Using the full dataset

After purchase, replace the sample with the full zcta_language.csv. Replace territories with records from your own CSV containing territory and postal_zip, keeping identifiers as text. The results list can be written to another CSV. Every input row stays present.

For language detail, use language_categories.csv. For example, C16001_005E identifies Spanish-at-home speakers age 5+ who speak English less than very well. Filter category_variable to that value before joining: pct divides by all residents age 5+, while pct_of_parent divides by Spanish-at-home speakers age 5+. The file includes both denominators and their margins.

The source distinguishes Spanish, Korean, Chinese, Vietnamese, Tagalog, Arabic and broader language groups. Preserve Census’s combined labels: Chinese includes Mandarin and Cantonese, while French, Haitian and Cajun appear as one group. The more detailed B16001 table did not supply ZCTA values in the source pilot; this edition uses the published grouped C16001 table.

C16002 assigns a household language from its first non-English-speaking member in Census’s relationship order, beginning with the householder and spouse. It is not simply the householder’s language, and an English-only speaker can belong to a non-English-language household. Keep this household universe separate from C16001’s people age 5+.

Parent subtotals overlap their child categories. Choose one category, or the leaf rows of one table, before aggregating. Repeated ZIPs in a customer file repeat area context, so summing the joined population would double count. The archive retains all 52 original estimate/MOE pairs per area, annotations, dictionaries and source accounting.

The ZIP-area demographic profile and household composition reference provide optional context using the same period and geography. This example requires only the language reference.

Sources and versions

Source: U.S. Census Bureau, 2020–2024 ACS five-year tables C16001 and C16002, released January 29, 2026. The 2024 ACS geography reference uses 2020 ZCTA delineations and includes Puerto Rico.

Original Census tables · Language definitions · ZCTA definitions · Source and preparation record.

Published count margins are retained. Derived sums and shares use documented Census approximations, with a flagged ratio fallback where required. Same-edition processing improvements and publisher error corrections are included. Future source editions may be sold separately.