Public
Edited
May 17, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
x: {
round: true
},
color:{
scheme: "Reds"
},
marks:[
Plot.barX(monthly_sums, {
x: "month",
interval: "month",
inset: 0, // no gaps
fill: barVar
})
]
})
Insert cell
Insert cell
fails = (await FileAttachment("bfb-data.csv").csv({array: true}))
.slice(1, -2)
.map((d) => ({
"Bank Name": d[0].split(", ")[0],
"City, State": d[0].split(", ").slice(1).join(", "),
"Date": parseDate(d[2]),
"Assets": parseAssets(d[3]),
"Acquirer": d[5]
}))
Insert cell
parseDate = d3.utcParse("%d-%b-%y")
Insert cell
parseAssets = (x) => parseFloat(x.replace(/[^\d.]/g, ""))
Insert cell
import {aq, op} from '@uwdata/arquero'
Insert cell
monthly_sums = aq.from(fails)
.derive({
month: aq.escape(d => d3.timeFormat("%m")(d.Date)),
year: aq.escape(d => d3.timeFormat("%Y")(d.Date))
})
.derive({month: aq.escape(d => new Date(Date.UTC(d.year, d.month, 1)))})
.groupby('month')
.rollup({
failures: d => op.count(),
total_assets: d => op.sum(d.Assets)
})
Insert cell
monthly_sums
Type Table, then Shift-Enter. Ctrl-space for more options.

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