Published unlisted
Edited
May 17, 2022
Insert cell
# Akaki Water Quality
Insert cell
Changed in fork
-
dataset = FileAttachment("Akaki_WQ-1.csv").csv({typed: true})
+
dataset = { const data = await FileAttachment("Akaki_WQ-1.csv").csv({typed: true}); for (const column of data.columns) { for (const d of data) { // If any string values appear to be comma-formatted numbers, // remove the commas and then coerce them to proper numbers. if (typeof d[column] === "string" && /^(\d|,)+(\.\d+)?$/.test(d[column])) { d[column] = +d[column].replace(/,/g, ""); } } } return data; }
Insert cell
Plot.plot({
height: 540,
grid: true,
marks: [
Plot.dot(dataset, {x: "BOD mg/l", y: "EC"})
]
})
Insert cell
Plot.plot({
height: 640,
grid: true,
x: {
label: "Carats →"
},
y: {
label: "↑ Price ($)"
},
r: {
range: [0, 20]
},
marks: [
Plot.dot(diamonds, Plot.bin({r: "count"}, {x: "carat", y: "price", thresholds: 100}))
]
})
Insert cell