Published
Edited
Oct 13, 2021
Fork of Simple D3
1 star
Insert cell
Insert cell
rawData = FileAttachment("ALL_STATE_stories.csv").csv()
Insert cell
Insert cell
Insert cell
Insert cell
data = rawData.map(
(element) => ({
...element, // retain old values using spread syntax
date: new Date(element.date.substring(0,10)), // update date to hold a Date object
covidRatio: element.covid / element.total, // add a new field covidRatio that is the ratio of covid news to total news
})
);
Insert cell
Insert cell
Insert cell
aq.from(
data.map(
(element) => ({
...element,
// add your new key value pair here
})
)).view();
Insert cell
Insert cell
Insert cell
ratioOverHalf = data.filter((element) => {
return element.covidRatio > 0.5
});
Insert cell
Insert cell
Insert cell
Insert cell
aq.from(
data.filter((element) => {
// add your code here when you run the code it will show up
})).view();
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