Public
Edited
Sep 1, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
rawData = FileAttachment("StockX-Data-Contest-2019-31.csv").csv()
Insert cell
Insert cell
Insert cell
stateData = FileAttachment("state-abbrevs1.csv").csv()
Insert cell
Insert cell
Insert cell
data = rawData.map(d => ({
buyer_region: d.Buyer_Region,
brand: d.Brand,
sneaker_name: d.Sneaker_Name
}))
Insert cell
viewof df = aq.from(data).view()
Insert cell
viewof dsf = aq.from(stateData).view()
Insert cell
viewof finalSneaker = df.join(dsf, ["buyer_region", "state"]).view()
Insert cell
Insert cell
Insert cell
columns = ["abbreviation", "brand", "sneaker_name"]
Insert cell
viewof groupKey = Select(["abbreviation"], { label: "Group by" })
Insert cell
viewof colorKey = Select(["brand"], { label: "Color by", value: ["brand"] })
Insert cell
viewof groupPivotedData = finalSneaker
.select(groupKey, colorKey)
.groupby(groupKey, colorKey)
.count()
.groupby(groupKey)
.pivot(colorKey, "count")
.view()
Insert cell
chartData = groupPivotedData.objects()
Insert cell
finalData = Object.assign(chartData, { y: "Number of Sneakers Bought" })
Insert cell
keys = df
.groupby(colorKey)
.count()
.column(colorKey).data
Insert cell
Insert cell
import { navio } from "@john-guerra/navio"
Insert cell
import { aq, op } from '@uwdata/arquero'
Insert cell
import { Select } from "@observablehq/inputs"
Insert cell
import { chart } with {
finalData as data,
groupKey,
keys
} from "@d3/grouped-bar-chart"
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more