Public
Edited
Feb 12, 2023
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

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more