Public
Edited
Jun 27, 2023
Fork of Aya H - RN
Insert cell
Insert cell
Insert cell
file.name
Insert cell
md ``
Insert cell
Insert cell
new_comparison = clean
.select('market', 'spend', 'leads', 'bgc', 'new_market_june')
.groupby('new_market_june')
.rollup({
spend: d => op.sum(d.spend),
leads: d => op.sum(d.leads),
bgc: d => op.sum(d.bgc)
})
.derive({
cpa: d => d.spend / d.leads,
cpbgc: d => d.spend / d.bgc
})
.objects()
Insert cell
Insert cell
Insert cell
Insert cell
new_market = ['ORF', 'CVG', 'OGG', 'HNL', 'LIH', 'KOA']
Insert cell
new_market_lc = new_market.map(d => op.lower(d))
Insert cell
Insert cell
viewof clean = aq.from(raw_data)
.rename({
'Additional Fields.Geo Code': 'market'
})
.derive({
spend: d => +op.replace(d.Actual, ',', ''),
leads: d => d['Total Leads'],
bgc: d => d.BGC
})
.derive({
new_market_june: aq.escape(d => new_market_lc.includes(d.market) == true ? true : false)
})
.view()
Insert cell
raw_data = file.csv({typed: true})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// this is a really cool way of displaying tables. Much more aesthetically pleasing than the defaults of arquero and input.table

import { formatTable } from "@saneef/pretty-tables"
Insert cell
Insert cell
import {toc} from "@nebrius/indented-toc"
Insert cell
Insert cell
date_parser = d3.utcParse('%m/%d/%Y')
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// sample of how to place html blocks in a grid

// html `<div style="display: grid; grid-template-columns: 1fr 1fr 1fr; column-gap: 0px; row-gap: 5px;">
// ${viewof spend}
// ${viewof cpl}
// ${viewof cpc}
// </div>`
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