Public
Edited
May 26, 2023
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// DOM.download(
// serialize(
// yearQueryResults.map(
// ({
// year,
// state,
// trend,
// totalFrom,
// totalBizFrom,
// pctBizFrom,
// totalTo,
// pctBizTo,
// totalBizTo,
// ...keepAttrs
// }) => keepAttrs
// )
// ),
// "_usps-coa-data-state_2019-2022.csv",
// "Download change of address data by state as a .csv file"
// )
Insert cell
Insert cell
Insert cell
Insert cell
// DOM.download(
// serialize(
// yearQueryResults
// .filter((d) => d.city === filterCity)
// .map(
// ({
// year,
// state,
// trend,
// totalFrom,
// totalBizFrom,
// pctBizFrom,
// totalTo,
// pctBizTo,
// totalBizTo,
// ...keepAttrs
// }) => keepAttrs
// )
// ),
// "_usps-coa-data-city_2019-2022.csv",
// "Download change of address data by city as a .csv file"
// )
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
test = yearQueryResults
.filter((d) => d.city != filterCity)
.reverse()
.sort((a, b) => a.netChangeBiz - b.netChangeBiz)
.slice(0, 5)
.map((d) => {
let city = d.city;
let zipcode = d.zipcode;
let trend = d.trend;
let netChangeBiz = d.netChangeBiz;
return Math.abs(netChangeBiz).toLocaleString("en-US");
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// formattedData = {
// const objects = [];
// combinedData.forEach(function (d) {
// objects.push({
// year: d["YYYYMM"].toString().substring(0, 4),
// month: d["YYYYMM"].toString().substring(4, 6),
// zipcode: d["ZIPCODE"].toString().substring(2, 7),
// city: titleCase(d["CITY"].trim()),
// state: d["STATE"],
// totalFrom: d["TOTAL_FROM_ZIP"],
// totalBizFrom: d["TOTAL_BUSINESS_FROM_ZIP"],
// totalTo: d["TOTAL_TO_ZIP"],
// totalBizTo: d["TOTAL_BUSINESS_TO_ZIP"]
// });
// });
// return objects;
// }
Insert cell
// combinedData = _2022Data.concat(_2021Data, _2020Data, _2019Data)
Insert cell
// _2022Data = FileAttachment("Y2022@2.csv").csv({ typed: true })
Insert cell
// _2021Data = FileAttachment("Y2021.csv").csv({ typed: true })
Insert cell
// _2020Data = FileAttachment("Y2020@2.csv").csv({ typed: true })
Insert cell
// _2019Data = FileAttachment("Y2019@2.csv").csv({ typed: true })
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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