Public
Edited
Jun 8, 2023
Insert cell
Insert cell
Insert cell
file.name
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
active_list = aq.from(raw_active_list)
.filter(d => d.Status == 'Active')
.select('Campaign')
.filter(d => op.includes(op.lower(d.Campaign), 'craigs') == false)
.filter(d => d.Campaign != 'Do Not Sponsor' && d.Campaign != 'All Other')
.array('Campaign')
Insert cell
raw_active_list = FileAttachment("lyft-by_campaign-2023-06-08-2023-06-08.csv").csv()
Insert cell
Insert cell
Insert cell
viewof clean = aq.from(raw_data)
.filter(aq.escape(d => d.date >= start_date && d.date <= end_date))
.filter(aq.escape(d => active_list.includes(d.title)))
.rename({master_publisher_aggregated: 'Publisher'})
.derive({
date: aq.escape(d => d3.utcMonday(d.date))
})
.groupby('date', 'title') //, 'Publisher')
.rollup({
spend: d => op.sum(d.spend),
bgc: d => op.sum(d.bgc)
})
.derive({
cpbgc: d => d.spend / d.bgc
})
.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