Notebooks 2.0 is here.

Public
Edited
Aug 1, 2023
Insert cell
Insert cell
Insert cell
Insert cell
// determine the extent of the date from your data
date_range = d3.extent(my_weather_df, d => d.startTime)
Insert cell
viewof start_date = Inputs.date({label: "Start", value: date_range[0]})
Insert cell
viewof end_date = Inputs.date({label: "End", value: date_range[1]})
Insert cell
my_weather_df
.filter(aq.escape(d => d.startTime >= start_date && d.startTime <= end_date))
.view()
Insert cell
filter_i_want
// or
// op.timestamp(filter_i_want)
Insert cell
Insert cell
// This is how I imagine it could work, IF the input is a vector from an arquero-data-frame. Except I want the first element in the value, not the last.
viewof filter_i_want = Inputs.select(new Map([["Aug 2", "2023-08-02T00:00:00.000"], ["Aug 2", "2023-08-02T00:01:00.000"], ["Aug 3", "2023-08-03T00:00:00.000"], ["Aug 3", "2023-08-03T00:10:00.000"]]), {value: "Aug 3", label: "dates to filter"})

Insert cell
Insert cell
my_teams_df
.filter(aq.escape(d => d.location == favorite.location))
.view()
Insert cell
favorite.location
Insert cell
Insert cell
viewof favorite = Inputs.select(teams, {
label: "Favorite team",
format: (x) => x.name,
value: teams.find((t) => t.name === "Warriors"),
sort: true, // trying to get 'unique' argument to apply
unique: true // this IS NOT applied as I would like.
})
Insert cell
Insert cell
viewof favorite1 = Inputs.select(my_teams_df, {
label: "Favorite team",
format: (x) => x.name,
value: my_teams_df.find((t) => t.name === "Warriors"),
sort: true, // trying to get 'unique' argument to apply
unique: true // this IS NOT applied as I would like.
})
Insert cell
Insert cell
my_teams_df.view()
Insert cell
teams = [
{name: "Lakers", location: "Los Angeles, California"},
{name: "Warriors", location: "San Francisco, California"},
{name: "Celtics", location: "Boston, Massachusetts"},
{name: "Celtics", location: "Boston baked, Massachusetts"},
{name: "Celtics", location: "Boston beans, Massachusetts"},
{name: "Nets", location: "New York City, New York"},
{name: "Raptors", location: "Toronto, Ontario"},
{name: "Raptors", location: "Toronto, Ontario"},
]
Insert cell
teams
Insert cell
my_teams_df = aq.from(teams)
Insert cell
Insert cell
Insert cell
my_weather_df
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
my_weather_df.view()
Insert cell
Insert cell
import { aq, op } from '@uwdata/arquero'
Insert cell
import {my_weather_df} from "078842e2bb3fa0a0"
Insert cell
import {periods_json} from "078842e2bb3fa0a0"
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