Published
Edited
Jan 22, 2022
1 fork
Insert cell
md`# COVID-19 Report for CT Counties`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = d3.csv("https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-counties.csv")
Insert cell
Insert cell
ctcounties = ["Fairfield","Middlesex","Litchfield","New London","New Haven","Tolland","Windham", "Hartford"]
Insert cell
Insert cell
function movingAverage(values, N) {
let i = 0;
let sum = 0;
const means = new Float64Array(values.length).fill(NaN);
for (let n = Math.min(N - 1, values.length); i < n; ++i) {
sum += values[i];
}
for (let n = values.length; i < n; ++i) {
sum += values[i];
means[i] = sum / N;
sum -= values[i - N + 1];
}
return means;
}
Insert cell
pdata.sort((a,b)=>d3.descending(Date.parse(a.date),Date.parse(b.date)))
Insert cell
pdata.map(x=>(Date.parse(x.date)))
Insert cell
pdata
Insert cell
Date.parse("2020-05-09")
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