Geographic heat maps turn rows of ZIP code data into visual market intelligence. This tutorial uses Python and Folium to build an interactive choropleth map coloured by gross yield or price change.
Requirements
pip install requests folium geopandas pandas
Fetching Data for a Region
import requests, pandas as pd
KEY = "your_key"
TARGET_ZIPS = ["73301","73344","78701","78702","78703","78704","78705"]
rows = []
for z in TARGET_ZIPS:
r = requests.get("https://zipmarketdata.com/rental-yield",
params={"zip_code": z, "bedrooms": 2},
headers={"x-rapidapi-proxy-secret": KEY})
if r.ok:
rows.append(r.json())
df = pd.DataFrame(rows)
Building the Map
import folium
from folium.plugins import HeatMap
# Load ZIP code boundary GeoJSON (from census.gov TIGER data)
import geopandas as gpd
zips_gdf = gpd.read_file("cb_2023_us_zcta520_500k.zip")
zips_gdf = zips_gdf.merge(df, left_on="ZCTA5CE20", right_on="zip_code")
m = folium.Map(location=[30.26, -97.74], zoom_start=10)
folium.Choropleth(
geo_data=zips_gdf.to_json(),
data=df, columns=["zip_code", "gross_yield_pct"],
key_on="feature.properties.zip_code",
fill_color="YlOrRd", fill_opacity=0.7,
legend_name="Gross Rental Yield (%)"
).add_to(m)
m.save("yield_map.html")