Published
Edited
Sep 28, 2022
Insert cell
# HW 4
Insert cell
kc_house_data_1 = FileAttachment("kc_house_data.csv").csv({typed:true})
Insert cell
kc_house_data = kc_house_data_1.slice(0,2000);
Insert cell
import { SummaryTable } from "@observablehq/summary-table"
Insert cell
viewof summary_data = SummaryTable(kc_house_data)
Insert cell
Insert cell
import {vl} from '@vega/vega-lite-api-v5'
Insert cell
import {printTable} from '@uwdata/data-utilities'
Insert cell
vl.markLine().data(kc_house_data).encode(
vl.x().fieldQ('sqft_living').title('interior living space'),
vl.y().fieldQ('price').title('Price')
).title('house dataset').render()
Insert cell
vl.markPoint().data(kc_house_data).encode(
vl.x().fieldQ('sqft_living').title('interior living space').scale({domain: [0, 8000]}),
vl.y().fieldQ('price').title('Price').scale({domain: [0, 5000000]}),
vl.tooltip(['id','sqft_living','price'])
).title('house dataset').render()
Insert cell
Insert cell
vl.markPoint().data(kc_house_data)
.encode(
vl.color().fieldN('grade').title('Grade'),
vl.size().fieldQ('price'),
vl.x().fieldQ('lat').scale({domain: [47.15, 47.8]}),
vl.y().fieldQ('long').scale({domain: [-122.6, -121.6]})
).title('house dataset')
.width(width)
.height(300).render()
Insert cell
Insert cell
vl.markBar().data(kc_house_data_1).encode(
vl.x().fieldQ('price').title('Price'),
vl.y().count().title('Counts')
).title('house dataset').render()
Insert cell
vl.markBar().data(kc_house_data_1).encode(
vl.x().fieldQ('bedrooms').title('Number of Bedrooms'),
vl.y().count().title('Counts')
).title('house dataset').render()
Insert cell
vl.markBar().data(kc_house_data_1).encode(
vl.x().fieldQ('bathrooms').title('Number of Bathrooms'),
vl.y().count().title('Counts')
).title('house dataset').render()
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