Published
Edited
May 8, 2022
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = FileAttachment("temperature_.csv").csv()
Insert cell
Insert cell
Insert cell
Inputs.table(data)
Insert cell
Insert cell
import {SummaryTable} from "@observablehq/summary-table"
Insert cell
Insert cell
SummaryTable(data)
Insert cell
Insert cell
Insert cell
Insert cell
data_autoTyped = FileAttachment("temperature_.csv").csv({typed: true})
// typed:true so java detects what type the date is for example and not mark it as a string
Insert cell
Insert cell
Insert cell
Inputs.table(data_autoTyped)
Insert cell
Insert cell
Insert cell
SummaryTable(data_autoTyped)
Insert cell
Insert cell
data_autoTyped[0].date.constructor.name
Insert cell
data_autoTyped[0].temperature.constructor.name
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
parseTime = d3.timeParse("%Y-%m-%d") // 2011-10-07
// %Y is year, %m is month and %d is day and dash "-" in between to look for dash seperator
Insert cell
Insert cell
Insert cell
parseTime("2011-10-02")
// Java starts at day 0!
Insert cell
Insert cell
Insert cell
data_manuallyTyped = FileAttachment("temperature.csv")
.csv() // no `{typed: true}` in `csv()`
.then((data) => {
data.forEach((d) => {
d.date = parseTime(d.date);
d.temperature = Number(d.temperature / 1.8) - 32;
});
return data;
})
// for csv we put .then and it is faster
// converts Fahrenheit to Celsius -> (fahrenheit- 32)/1.8 This is thereal formula!! Yours is wong @professor
Insert cell
Insert cell
Insert cell
Inputs.table(data_manuallyTyped)
Insert cell
Insert cell
Insert cell
SummaryTable(data_manuallyTyped)
Insert cell
Insert cell
Insert cell
Insert cell
imageToDo
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