Published
Edited
May 12, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
meteorites_data = FileAttachment("meteorites.csv").csv()
Insert cell
Insert cell
Insert cell
Insert cell
Inputs.table(meteorites_data)
Insert cell
Insert cell
Insert cell
SummaryTable(meteorites_data)
Insert cell
Insert cell
Insert cell
meteorites_data_autoTyped = FileAttachment("meteorites.csv").csv({
typed: true
})
Insert cell
Insert cell
Insert cell
SummaryTable(meteorites_data_autoTyped)
Insert cell
Insert cell
Insert cell
Inputs.table(meteorites_data_autoTyped)
Insert cell
Insert cell
Insert cell
Insert cell
Inputs.table(meteorites_data_autoTyped, {
format: {
year: (cell) => cell.toFixed(0)
}
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
meteorites_temporary = FileAttachment("meteorites.csv")
.csv({ typed: true })
.then((data) => {
data.forEach((d) => {
d.year = new Date(d.year, 0, 1); // parse the Date column using `new Date(year, month, day, hours, minutes, seconds, milliseconds)`
d.mass = d.mass / 1_000_000; // convert mass from grams to tons
});
return data;
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Inputs.table(meteorites_temporary)
Insert cell
Insert cell
Insert cell
meteorites_data_fixed = aq
.from(meteorites_temporary)
.rename({ year: "date" })
.objects() // Uncomment to return an array of objects
Insert cell
Insert cell
Insert cell
Inputs.table(meteorites_data_fixed)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
apple_raw_data = FileAttachment("apple.csv").csv({ typed: true })
Insert cell
Insert cell
aapl_temp = FileAttachment("apple.csv")
.csv({ typed: true })
.then((dataset) => {
dataset.forEach((d) => {
let parseTime = d3.timeParse("%m/%d/%Y"); // configure d3.timeParse() to mirror the date format in the data
d.Date = parseTime(d.Date); // use the parser on the date column
d.Volume = +d.Volume; // make 'Volume' a number (so, not a string)
d["Close/Last"] = +d["Close/Last"].slice(1); // make Open, High, Low columns' values numbers (you need to first get rid of the '$' signs)
d.Open = +d["Open"].slice(1);
d.High = +d["High"].slice(1);
d.Low = +d["Low"].slice(1);
});
return dataset;
})
Insert cell
Insert cell
Insert cell
apple = aq.from(aapl_temp).rename({ "Close/Last": "Close" }).objects()
Insert cell
Insert cell
Insert cell
Inputs.table(apple)
Insert cell
Insert cell
Insert cell
SummaryTable(apple)
Insert cell
Insert cell
// import "Wrangler" and "op" cells from "@observablehq/data-wrangler" notebook
Insert cell
// import "SummaryTable" cell from "@observablehq/summary-table" notebook
Insert cell
Insert cell
import {toc} from "@nebrius/indented-toc"
Insert cell
import {imageToDo} from "@clokman/student-blocks"
Insert cell
imageToDo
Insert cell
import { SummaryTable } from "@observablehq/summary-table"
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