HMDA mortgage lending disparity analyzer — denial rates, racial disparities, lending deserts, and lender benchmarking
Project description
hmda-analyzer 📊
HMDA mortgage lending disparity analyzer.
Compute denial rate disparities by race, identify lending deserts, benchmark lenders against peers, and generate fair lending analysis reports — using CFPB HMDA LAR data. Free public API, no authentication required.
Why hmda-analyzer?
HMDA data covers 10+ million mortgage applications per year with borrower demographics, denial rates, loan amounts, and census tract locations. It is the most powerful public dataset for analyzing mortgage lending disparities — but it requires significant engineering to use. hmda-analyzer makes it accessible in Python.
Installation
pip install hmda-analyzer
Quickstart
from hmdaanalyzer import (
load_sample, denial_rate_by_race, disparity_ratio,
lending_by_tract, lender_summary, generate_disparity_report,
)
# Load sample data (no API required)
df = load_sample(n=5000)
# Or load from CFPB API (real data)
# df = load_from_api(year=2023, state="IL")
# Denial rates by race
rates = denial_rate_by_race(df)
print(rates)
# Disparity ratios vs White applicants
disparities = disparity_ratio(df)
print(disparities)
# Geographic analysis
tracts = lending_by_tract(df)
deserts = lending_by_tract(df)
# Lender analysis
summary = lender_summary(df, lei="LEI000001")
# Full disparity report
report = generate_disparity_report(df, title="Illinois Mortgage Market 2023")
print(report)
Analyses Supported
- Denial rate by race and ethnicity
- Disparity ratios vs reference group (default: White applicants)
- Denial rate by income band
- Denial reasons by race
- Lending activity by census tract, county, and state
- Lending desert identification (low application volume tracts)
- Lender vs market comparison
- Top lenders by origination volume
Disparity Ratio Thresholds
Based on CFPB fair lending examination standards:
-
= 2.0x — HIGH disparity (triggers regulatory scrutiny)
-
= 1.5x — MODERATE disparity
- < 1.5x — LOW disparity
- < 1.0x — FAVORABLE (group has lower denial rate than reference)
Data Sources
CFPB HMDA Data Browser API — free, no API key required. 2024 data covers 4,908 institutions and millions of loan applications.
https://ffiec.cfpb.gov/data-browser/
Running Tests
PYTHONPATH=. pytest tests/ -v
28 tests across all modules.
Who This Is For
- Fair lending analysts and compliance teams at banks and CDFIs
- Community reinvestment researchers studying mortgage disparities
- Journalists covering housing discrimination and redlining
- Regulators and examiners analyzing lender performance
- Academics studying racial wealth gaps and homeownership barriers
License
MIT 2026 Jaypatel1511
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hmda_analyzer-0.1.0.tar.gz.
File metadata
- Download URL: hmda_analyzer-0.1.0.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79ec53c0ab3047add2a97147eafe0ce71f5844e61a57f8a31148003e66be0af3
|
|
| MD5 |
214b70d7d00b2ff7498badf903ee8055
|
|
| BLAKE2b-256 |
d6718d2999154c68c94f063921915659eccb236c5c1b300f2b8a3741dc2fff18
|
File details
Details for the file hmda_analyzer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hmda_analyzer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2436c9a1c290f2333ec6c20dba0c181b261287278e6349cf726ac50b17446b2a
|
|
| MD5 |
b3a4c773d9ca3c077f3a794985b389f8
|
|
| BLAKE2b-256 |
a5458df25e94da4d09b3b922c72b6bfa7fa5f56206e86e375163468b7e79b2a3
|