Published
Edited
Apr 10, 2022
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
getDataOfDate = (date) =>
data.filter((d) => d.date.getTime() === date.getTime())
Insert cell
d3.group(data, (d) => d.pref)
Insert cell
data.slice(-1)
Insert cell
dates = [...d3.group(data, (d) => d.date).keys()]
Insert cell
data = (await d3.csv(uri, d3.autoType)).map((d) => ({
date: new Date(d.日付),
pref: d.都道府県名.replace(/[都府県]$/, ""),
cases: d.各地の感染者数_1日ごとの発表数,
deaths: d.各地の死者数_1日ごとの発表数,
movingAvg: d.各地の直近1週間の人口10万人あたりの感染者数 || 0,
...d
}))
// .filter((d) => d.日付 === "2021/5/10")
Insert cell
uri = `https://www3.nhk.or.jp/n-data/opendata/coronavirus/nhk_news_covid19_prefectures_daily_data.csv`
Insert cell
exampleData = japan.map((d) => ({
value: Math.random() * 100,
...d
}))
Insert cell
Insert cell
Insert cell
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