Zillow Data Scraper: How to Build a Rental Yield Screener with Python
You can screen rental candidates from public listing data in about eighty lines of Python: pull a bounded set of for-sale records, divide the annual rent estimate by the asking price, filter out rows with missing or implausible values, and rank what is left. The arithmetic is trivial. What decides whether the shortlist is usable is everything around it — parsing currency strings, handling missing rent estimates, deduplicating the same property captured twice, and being explicit about what gross yield does and does not include. This guide is for investors, analysts, PropTech developers, and data engineers who want a repeatable screener built on the open-source data-scrape/zillow-data-scraper repository rather than a hand-maintained spreadsheet. It treats the repository as a collection layer and adds a small, auditable analysis layer on top — no private feed, authenticated portal, or paid endpoint.
TL;DR
- Use
data-scrape/zillow-data-scraperto capture public listing records for one geography and one listing type at a time. - Compute gross rental yield as
(monthly rent estimate × 12) ÷ asking price × 100. Keep the formula in code, not in a spreadsheet column somebody can overwrite. - Treat
rent_zestimateas optional. A screener that silently drops rows when the field is absent will bias your shortlist toward whatever segment happens to have coverage. - Deduplicate on
zpidfirst, thenurl, then a normalized address — duplicates are the most common cause of a shortlist that looks better than the market. - Log a coverage rate for every filter, so you can tell "no candidates" from "the data was missing".
- Pair it with
data-scrape/zillow-scraper-apifor recurring pulls in a stable, API-shaped JSON form. - Gross yield is a screening signal, not a return projection: it ignores vacancy, taxes, insurance, HOA dues, maintenance, capital expenditure, and financing.
Why Rental Yield Screening Breaks at Spreadsheet Scale
A single listing is easy to evaluate by hand; two hundred is where the process quietly degrades:
Money arrives as text. Prices and estimates commonly arrive as strings like $450,000, which either throw or coerce wrongly in arithmetic. Every numeric field needs an explicit parser with a documented fallback.
Rent estimates are patchy, and properties repeat. The repository documents a rent_zestimate field, but coverage varies by property type and market — compute yield only where both price and rent exist, and report that share. Paged results overlap, so deduplicate or one property can occupy five rows of your top ten. Sanity bounds also catch impossible rows cheaply, like four bedrooms at 620 square feet.
A snapshot is not a market. Rankings from a two-week-old export will disagree with today's ask prices.
Gross yield is not cash flow. Taxes, insurance, HOA dues, vacancy, maintenance, and financing can consume a large share of gross rent, and none appear in the listing record. Use the number to decide what deserves a deeper look, not what to buy.
What the Verified Repositories Provide
The data-scrape profile hosts Python repositories that share one pattern: a scraper.py entry point, a requirements.txt, an examples/ folder with sample output, and a README documenting the supported flags. They are reference implementations you run yourself, not hosted services, and each README states the code is for educational and research purposes, with the user responsible for complying with the target site's terms of service, robots directives, and applicable law — read it before you run anything.
data-scrape/zillow-data-scraper is the primary collection layer. Its README documents a CLI that takes a search phrase:
python scraper.py "Homes for sale in Austin, TX" \ --output results \ --format json \ --max-results 100 Documented options include --output (a filename prefix), --format (json, csv, or both), --max-results, --proxy, and --quiet. The documented field list includes zpid, address, price, zestimate, rent_zestimate, beds, baths, sqft, and url, and the README names "rental yield calculation" among its intended use cases.
data-scrape/zillow-scraper-api expresses the same idea in an API-shaped form: you pass a request-like string such as "GET /api/properties?location=Seattle,WA&price_max=500000" and receive JSON-shaped records, with documented fields including zpid, address, price, beds, baths, sqft, home_type, days_on_market, and url. It is a Python project with a local entry point, not a hosted production API — use it for scheduled pulls with a consistent request shape, and the first repository for straightforward search-phrase exports. Both produce JSON a downstream script can read without modification: collection stays in the repository, analysis stays in your own code.
The Screening Model
Three numbers do most of the work:
gross_yield_pct = (rent_zestimate * 12) / price * 100 price_to_zestimate = price / zestimate coverage = rows_with_both_price_and_rent / total_rows A price-to-estimate ratio well above 1 means the seller is asking more than the automated estimate; well below 1 means the opposite. It is a prompt to look closer, never a conclusion — automated estimates carry their own error. Log coverage every run: if it drops between runs, your query or the source layout changed. The screener then applies hard filters — minimum bedrooms, maximum price, a square-footage sanity band, a minimum yield — and ranks survivors by yield, with every threshold in an environment variable so a run can be reproduced exactly.
Environment Setup
Clone the collection layer and install its documented dependencies in an isolated environment:
git clone https://github.com/data-scrape/zillow-data-scraper.git cd zillow-data-scraper python -m venv .venv source .venv/bin/activate # Windows: .venv\Scripts\activate pip install -r requirements.txt Keep run configuration in environment variables rather than in code:
export TARGET_QUERY="Homes for sale in Austin, TX" export MAX_RESULTS="200" export OUTPUT_PREFIX="results" export PROXY_URL="" # optional; leave empty to run without one export INPUT_JSON="results.json" # file produced by the repository CLI export OUTPUT_CSV="yield_shortlist.csv" export MIN_YIELD="4.5" export MAX_PRICE="650000" export MIN_BEDS="2" --output is documented as a filename prefix, so confirm the exact filename your version prints before pointing INPUT_JSON at it. If your export nests records under a wrapper key, the loader below handles the common shapes.
Runnable Python Screener
The script uses only the standard library. It reads the repository's JSON export, normalizes fields, deduplicates, filters, ranks, and writes a CSV.
import csv import json import os import re from pathlib import Path INPUT_JSON = Path(os.environ.get("INPUT_JSON", "results.json")) OUTPUT_CSV = Path(os.environ.get("OUTPUT_CSV", "yield_shortlist.csv")) MIN_YIELD = float(os.environ.get("MIN_YIELD", "4.5")) MAX_PRICE = float(os.environ.get("MAX_PRICE", "650000")) MIN_BEDS = int(os.environ.get("MIN_BEDS", "2")) MONEY_RE = re.compile(r"[-+]?\d[\d,]*\.?\d*") FIELDS = [ "zpid", "address", "price", "monthly_rent", "annual_rent", "gross_yield_pct", "price_to_zestimate", "beds", "baths", "sqft", "days_on_market", "url", ] def money(value): """Parse '$450,000' or 450000 into a float; return None if not parseable.""" if value is None: return None if isinstance(value, (int, float)): return float(value) match = MONEY_RE.search(str(value)) if not match: return None try: return float(match.group(0).replace(",", "")) except ValueError: return None def as_int(value): if value is None: return None try: return int(float(str(value).replace(",", "").strip())) except ValueError: return None def load_records(path): if not path.exists(): raise SystemExit(f"Input not found: {path}. Run the repository CLI first.") payload = json.loads(path.read_text(encoding="utf-8")) if isinstance(payload, dict): payload = payload.get("results") or payload.get("data") or [payload] records = [] for row in payload: if not isinstance(row, dict): continue nested = row.get("result") or row.get("data") records.append(nested if isinstance(nested, dict) else row) return records def screen(records): rows, seen = [], set() stats = {"input": len(records), "no_price_or_rent": 0, "duplicate": 0, "failed_filters": 0, "kept": 0} for record in records: price = money(record.get("price")) rent = money(record.get("rent_zestimate")) if price is None or rent is None or price <= 0 or rent <= 0: stats["no_price_or_rent"] += 1 continue key = str(record.get("zpid") or record.get("url") or record.get("address") or "") if not key or key in seen: stats["duplicate"] += 1 continue seen.add(key) beds = as_int(record.get("beds")) sqft = as_int(record.get("sqft")) if beds is None or beds < MIN_BEDS: stats["failed_filters"] += 1 continue if price > MAX_PRICE: stats["failed_filters"] += 1 continue if sqft is not None and not (200 <= sqft <= 10000): stats["failed_filters"] += 1 continue gross_yield = (rent * 12) / price * 100 if gross_yield < MIN_YIELD: stats["failed_filters"] += 1 continue zestimate = money(record.get("zestimate")) rows.append({ "zpid": record.get("zpid"), "address": record.get("address"), "price": round(price, 2), "monthly_rent": round(rent, 2), "annual_rent": round(rent * 12, 2), "gross_yield_pct": round(gross_yield, 2), "price_to_zestimate": round(price / zestimate, 3) if zestimate else None, "beds": beds, "baths": record.get("baths"), "sqft": sqft, "days_on_market": as_int(record.get("days_on_market")), "url": record.get("url"), }) stats["kept"] += 1 rows.sort(key=lambda item: item["gross_yield_pct"], reverse=True) return rows, stats def main(): records = load_records(INPUT_JSON) rows, stats = screen(records) with OUTPUT_CSV.open("w", newline="", encoding="utf-8") as handle: writer = csv.DictWriter(handle, fieldnames=FIELDS) writer.writeheader() writer.writerows(rows) coverage = (stats["input"] - stats["no_price_or_rent"]) / stats["input"] if stats["input"] else 0 print(f"records in: {stats['input']}") print(f"missing price or rent: {stats['no_price_or_rent']}") print(f"duplicates skipped: {stats['duplicate']}") print(f"filtered out: {stats['failed_filters']}") print(f"candidates kept: {stats['kept']}") print(f"price+rent coverage: {coverage:.1%}") print(f"written: {OUTPUT_CSV}") for row in rows[:10]: yield_text = f"{row['gross_yield_pct']:.2f}%" print(f"{yield_text:>7} ${row['price']:,.0f} ${row['monthly_rent']:,.0f}/mo {row['address']}") if __name__ == "__main__": main() Two design choices are deliberate: missing data is counted, not silently dropped — the counters are the only defence against a shortlist that looks clean because the messy rows disappeared — and thresholds are read once at import time, so a run is reproducible from the environment block above.
Representative Output
The console summary is the part to read before the CSV:
records in: 184 missing price or rent: 23 duplicates skipped: 11 filtered out: 126 candidates kept: 24 price+rent coverage: 87.5% written: yield_shortlist.csv A candidate table built from illustrative records might look like this (example values showing the output shape, not market data):
| address | price | monthly_rent | gross_yield_pct | price_to_zestimate | beds | sqft |
|---|---|---|---|---|---|---|
| 123 Main St, Austin, TX | 412,000 | 2,150 | 6.26 | 0.971 | 3 | 1,480 |
| 88 Oak Ave, Austin, TX | 365,000 | 1,850 | 6.08 | 1.014 | 2 | 1,120 |
| 4471 Cedar Rd, Austin, TX | 529,000 | 2,400 | 5.44 | 0.988 | 4 | 2,050 |
| 902 Birch Ln, Austin, TX | 610,000 | 2,300 | 4.52 | 1.031 | 3 | 1,760 |
Read the last two columns together: a high yield paired with a ratio well above 1 can mean the seller is optimistic and the rent estimate has not caught up, while an ordinary yield with a ratio near 1 is often the more reliable row.
Pre-Flight Checklist
- Coverage rate above your floor. If fewer than roughly three quarters of captured rows have both price and rent, widen the query or narrow the property type before trusting the ranking.
- Duplicate rate small and stable. A spike usually means pagination overlapped or the export includes multiple listing states.
- Fields plausible. Reject square footage outside a wide sanity band; a four-bedroom record at 620 square feet is a parsing problem, not a bargain.
- Unit type comparable. Condos and single-family homes in one ranked list mix two rent and expense structures; split them.
- At least three rows recomputed by hand. Divide annual rent by price for three candidates and check against a calculator.
Comparison: Repository Pipeline vs Managed API vs Licensed Feed vs Manual Review
| Option | Best for | Setup model | Maintenance burden |
|---|---|---|---|
| Open-source repository pipeline (this workflow) | A transparent, versioned screening model you own | Clone, install, run locally or on your own worker | Yours: selector drift, pacing, retries |
| Managed scraping API | Teams that would rather not operate collection | Subscribe, send requests, receive JSON | Provider handles access; you handle mapping |
| Licensed data feed or partner programme | Products needing contractual coverage | Contract and credentials from the provider | Provider-managed, governed by the agreement |
| Manual review | Small, high-conviction decisions | Browser and spreadsheet | Time; it does not scale |
Choose the repository path when the screener itself is the asset you want to own; a managed API when collection is the part you do not want to debug; a licensed feed when terms and coverage guarantees matter more than cost. Confirm current pricing, quotas, and terms on the provider's own pages — this article deliberately states no figures.
Use Cases
Deal sourcing for a small portfolio. Run the screener weekly over two or three target ZIPs and watch which properties stay in the top decile across runs — persistence across captures beats a single high yield.
CMA preparation and portfolio benchmarking. The same output shows how asking prices sit against automated estimates before an agent writes a comparative market analysis, and matching held addresses against current rent estimates tells property managers whether in-place rents are drifting from the market.
Data quality regression testing. The reported counters double as a monitor for the collection layer — a jump in missing price or rent is an early warning that the layout or query changed.
PropTech prototyping. The normalized CSV is a convenient fixture for testing ranking logic or dashboards before connecting a production data source.
Limits, Compliance, and Maintenance
Terms of service come first. Publicly visible pages are not the same as data you are licensed to collect at scale. Review the target site's terms, robots directives, and applicable agreements before running a collection job, and prefer official partner or licensed access where your use case requires it — the repository's README places that responsibility on the operator.
Keep scope to public listing information. Do not reach into authenticated areas, agent-only notes, or private contact data, and do not work around access controls, rate limits, or CAPTCHA challenges. If the site blocks a request, stop and reconsider rather than escalating.
Estimates are estimates. zestimate and rent_zestimate are automated valuations that can lag the market or be absent entirely — never present one as an appraisal or a guaranteed rent. Listing photos and descriptions are third-party content; republishing them usually requires permission.
Expect layout drift, and pace your runs. Collection code breaks when the source changes — pin the validated repository version, run a small canary query first, and keep the raw JSON so a failed parse can be re-run without re-collecting. Weekly runs usually suffice, and a bounded --max-results keeps a single run reviewable. Store the raw JSON, CSV, thresholds, and timestamp together as an audit trail, so a shortlist can be explained later.
FAQ
Is there an official Zillow API I should use instead?
Zillow's public website is not an open API, and access is governed by its own terms and partner arrangements. Review Zillow's current terms directly and treat any third-party claim of "official" access with suspicion.
What exactly does the yield formula measure?
Gross rental yield: annual rent estimate divided by asking price, as a percentage. It is a comparability signal, not net yield, cap rate, cash-on-cash return, or IRR — it excludes operating expenses, vacancy, and financing.
Why does my shortlist have so few rows?
Check the counters. Low price+rent coverage means rent estimates are missing for much of your query; a high filtered out count means thresholds are too tight. Neither is a bug by itself, but both change what the ranking means.
Can I use the API-shaped repository instead?
Yes. data-scrape/zillow-scraper-api returns JSON-shaped records and its documented fields include days_on_market, which the screener can use as an additional filter. You run it yourself, so the same compliance and pacing rules apply.
How often should the screener run?
Weekly for deal sourcing; monthly for benchmarking. More frequent runs mostly add duplicates and rate-limit pressure without changing the ranking.
What happens when the source page layout changes?
The collection layer breaks, usually as an empty or partial export, which the script reports as a coverage collapse. Fix the selectors, pin the working version, and re-run.
Can this feed a CRM or an AI agent?
Yes. The CSV is a plain tabular artifact and the JSON export can be passed to an agent as structured context. Include the capture timestamp and source URL with each row so downstream consumers can judge freshness.
Next Steps
Start with one geography, one property type, and a small --max-results value. Confirm the repository runs and the export shape, read the counters before the ranking, and widen the query only once coverage and duplicate rates are stable.
- Collection layer:
data-scrape/zillow-data-scraper - API-shaped variant with
days_on_market:data-scrape/zillow-scraper-api - More public-data workflows:
data-scrapeon GitHub - Background reading on structuring public web data for market analysis: the Chinese-language guide to public web data for market research
If you build the screener, the most useful next iteration is not a better yield formula — it is a second capture. Comparing two weeks of the same geography tells you which candidates are holding their position, a far stronger signal than any single snapshot.


