Public
Edited
1 star
Insert cell
Insert cell
Insert cell
// Plot.plot({
// marks: [
// Plot.ruleY([0]),
// Plot.lineY(getRegion(homeValues, region), {
// x: "date",
// y: "price"
// }),
// Plot.lineY(getRegion(homeValuesForecast, region), {
// x: "date",
// y: "price"
// }),
// Plot.lineY(getRegion(rentals, region), {
// x: "date",
// y: "price"
// }),
// Plot.lineY(getRegion(inventory, region), {
// x: "date",
// y: "price"
// }),
// Plot.lineY(getRegion(listAndSalesPrices, region), {
// x: "date",
// y: "price"
// }),
// Plot.lineY(getRegion(salesCountPriceCuts, region), {
// x: "date",
// y: "price"
// })
// // Plot.lineY(getRegion(homeValues, "United States"), {
// // x: "date",
// // y: "price",
// // stroke: "silver"
// // })
// ]
// })
Insert cell
Insert cell
lineChart(homeValues, region)
Insert cell
Insert cell
lineChart(homeValuesForecast, region)
Insert cell
Insert cell
lineChart(rentals, region)
Insert cell
Insert cell
lineChart(inventory, region)
Insert cell
Insert cell
lineChart(listAndSalesPrices, region)
Insert cell
Insert cell
lineChart(salesCountPriceCuts, region)
Insert cell
Insert cell
regions = homeValues.map(({ RegionName }) => RegionName)
Insert cell
getRegion(homeValues, region)
Insert cell
getRegion = (data, region) =>
Object.entries(
data.find(({ RegionName }) => RegionName.match(new RegExp(region, "i"))) ||
data.find(({ RegionName }) => RegionName === "United States")
).reduce((result, [key, value]) => {
if (key.startsWith("20")) {
return [...result, { date: new Date(key), price: parseFloat(value) }];
}
return result;
}, [])
Insert cell
lineChart = (data, region) =>
Plot.plot({
marks: [
Plot.ruleY([0]),
Plot.lineY(getRegion(data, region), {
x: "date",
y: "price"
}),
// Plot.lineY(getRegion(data, "United States"), {
// x: "date",
// y: "price",
// stroke: "silver"
// })
]
})
Insert cell
// homeValues = FileAttachment(
// "Metro_zhvi_uc_sfrcondo_tier_0.33_0.67_sm_sa_month.csv"
// ).csv()
// homeValues = d3.csv(
// "https://files.zillowstatic.com/research/public_csvs/zhvi/Metro_zhvi_uc_sfrcondo_tier_0.33_0.67_sm_sa_month.csv?t=1669903116"
// )
homeValues = d3.csv(
"https://files.zillowstatic.com/research/public_csvs/zhvi/City_zhvi_uc_sfrcondo_tier_0.33_0.67_sm_sa_month.csv"
)
Insert cell
// homeValuesForecast = FileAttachment("Metro_zhvf_growth_uc_sfrcondo_tier_0.33_0.67_sm_sa_month.csv").csv()
homeValuesForecast = d3.csv(
"https://files.zillowstatic.com/research/public_csvs/zhvf_growth/Metro_zhvf_growth_uc_sfrcondo_tier_0.33_0.67_sm_sa_month.csv"
)
Insert cell
// rentals = FileAttachment("Metro_ZORI_AllHomesPlusMultifamily_Smoothed.csv").csv()
rentals = d3.csv(
"https://files.zillowstatic.com/research/public_csvs/zori/Metro_zori_sm_month.csv"
)
// rentals = d3.csv(
// "https://files.zillowstatic.com/research/public_csvs/zori/City_zori_sm_month.csv?t=1669903116"
// )
Insert cell
// inventory = FileAttachment("Metro_invt_fs_uc_sfrcondo_sm_month.csv").csv()
inventory = d3.csv(
"https://files.zillowstatic.com/research/public_csvs/invt_fs/Metro_invt_fs_uc_sfrcondo_sm_month.csv?t=1669903116"
)
Insert cell
// listAndSalesPrices = FileAttachment("Metro_mlp_uc_sfrcondo_sm_month.csv").csv()
listAndSalesPrices = d3.csv(
"https://files.zillowstatic.com/research/public_csvs/mlp/Metro_mlp_uc_sfrcondo_sm_month.csv"
)
Insert cell
// salesCountPriceCuts = FileAttachment(
// "Metro_sales_count_now_uc_sfrcondo_month.csv"
// ).csv()
salesCountPriceCuts = d3.csv(
"https://files.zillowstatic.com/research/public_csvs/sales_count_now/Metro_sales_count_now_uc_sfrcondo_month.csv"
)
Insert cell
import { zillow_data, map } from "@mcmcclur/zillow-home-prices"
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more