Published
Edited
Oct 25, 2020
Insert cell
md`# First Assignment`
Insert cell
import {fromColumns, printTable} from '@uwdata/data-utilities'

Insert cell
import {editor} from "@fil/json-editor"

Insert cell
import {form} from "@mbostock/form-input"
Insert cell
cars = require("@observablehq/cars")
Insert cell
desiredData = cars.map(d => {
var newd = {
Name : d["Name"],
Origin : d["Origin"],
Year : d["Year"],
Miles : +d["Miles_per_Gallon"],
Horsepower : +d["Horsepower"],
Weight : +d["Weight_in_lbs"] //d.Conditions
}
return newd;
});
Insert cell

viewof parameters = form(html`<form>
<div>
<label><input name="min" type=range min="10" max="5000" value="30" step="1"> <i>Minimum</i></label>
</div>
<div>
<label><input name="max" type=range min="10" max="100" value="60" step="1"> <i>Maximum</i></label>
</div>
<div> <select name="Origin">
<option value="USA">USA</option>
<option value="Japan">Japan</option>
<option value="Europe">Europe</option>
</form>`)
Insert cell
selectedCarsList = desiredData.filter(d => {
return d.Origin===parameters.Origin &&
d.Horsepower >= parameters.min &&
d.Horsepower <= parameters.max;})
.sort((a,b)=>b.Weight_in_lbs - a.Weight_in_lbs)
.slice(0,20);


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