Published
Edited
Mar 7, 2020
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
daysOnMarket_condoZip = fetch("https://streeteasy-market-data-download.s3.amazonaws.com/sales/Condo/daysOnMarket_Condo.zip")
.then(response => response.arrayBuffer())
.then(buffer => jszip.loadAsync(buffer));
Insert cell
daysOnMarket_condoString = daysOnMarket_condoZip.file("daysOnMarket_Condo.csv").async("string");
Insert cell
dasyOnMarketCondo = d3.csvParse(daysOnMarket_condoString);
Insert cell
Insert cell
totalInventory_CondoZip = fetch("https://streeteasy-market-data-download.s3.amazonaws.com/sales/Condo/totalInventory_Condo.zip")
.then(response => response.arrayBuffer())
.then(buffer => jszip.loadAsync(buffer));
Insert cell
totalInventory_CondoString = totalInventory_CondoZip.file("totalInventory_Condo.csv").async("string");
Insert cell
totalInventoryCondo = d3.csvParse(totalInventory_CondoString);
Insert cell
Insert cell
totalInventoryCondoPivot = {
const flatArray = []
const months = totalInventoryCondo.columns.filter((d) => d != "areaName" || d != "Borough" || d != "areaType" )

totalInventoryCondo.forEach(row => {
months.forEach(month => {
row["date"] = moment(month, "YYYY-MM-DD");
flatArray.push({date: row["date"],
val: +row[month],
area: row["areaName"],
boro: row["Borough"],
areaType: row["areaType"],
type: "total_inventory"});
});
})

return flatArray
}
Insert cell
Insert cell
d3 = require("d3@5");
Insert cell
moment = require('moment@2.22.2/moment.js');
Insert cell
jszip = require("jszip@3.1.5/dist/jszip.min.js");
Insert cell
JSZipUtils = require('https://bundle.run/jszip-utils@0.0.2');
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