Public
Edited
Mar 14, 2023
1 fork
Insert cell
Insert cell
Insert cell
powerplants_allUS_2021.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
data = FileAttachment("powerplants_allUS_2021.csv").csv() // parse the CSV file into an Array (list)
Insert cell
toNum = (text) => Number(text.replace(/,/g,'')); // a function to strip commas and make a number
Insert cell
data.forEach(d => {
// then iterate through the full dataset and clean two columns that we need.
if (d["Plant annual net generation (MWh)"] != null) {d["Plant annual net generation (MWh)"] = toNum(d["Plant annual net generation (MWh)"])}
if (d["Plant annual CO2 equivalent emissions (tons)"] != null) {d["Plant annual CO2 equivalent emissions (tons)"] = toNum(d["Plant annual CO2 equivalent emissions (tons)"])}
})
Insert cell
Insert cell
Insert cell
<svg width="1000" height="1000">
<text x="20" y="35" style="font-size:24px; font-family: sans-serif">U.S. Power Plants</text>
</svg>
Insert cell
viz = d3.select(powerplants) // select the SVG cell as a D3 object called viz
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