Pre-release (v1.6) Documentation: Download v1.6, Current Release Docs
Simple demonstration of Arquero using Allison Horst’s Palmer Penguins dataset.
import { aq, op } from '@uwdata/arquero' penguins = aq.loadCSV("palmer-penguins.csv") penguins.view()
penguins .groupby('species') .filter(d => d.body_mass_g > 0) .rollup({ count: op.count(), avg_mass: op.average('body_mass_g') }) .view()
If you want to use inputs in an arquero query, you can use the params method of table. Below is a simple example of filtering a dataset by the values provided.
params
viewof bill_length_min = Inputs.range( [32, 50], {value: 35, step: 1, label: "Bill length (min):"} ) viewof islands = Inputs.checkbox( ["Torgersen", "Biscoe", "Dream"], { value: ["Torgersen", "Biscoe"], label: "Islands:" } )
penguins .params({ blm: bill_length_min, i: islands }) .filter((d, $) => op.includes($.i, d.island) && d.bill_length_mm > $.blm) .view()
--- title: "Arquero" format: html: code-tools: true --- Simple demonstration of [Arquero](https://uwdata.github.io/arquero/) using Allison Horst's [Palmer Penguins](https://allisonhorst.github.io/palmerpenguins/) dataset. ```{ojs} import { aq, op } from '@uwdata/arquero' penguins = aq.loadCSV("palmer-penguins.csv") penguins.view() penguins .groupby('species') .filter(d => d.body_mass_g > 0) .rollup({ count: op.count(), avg_mass: op.average('body_mass_g') }) .view() ``` If you want to use inputs in an arquero query, you can use the `params` method of table. Below is a simple example of filtering a dataset by the values provided. ```{ojs} //| panel: input viewof bill_length_min = Inputs.range( [32, 50], {value: 35, step: 1, label: "Bill length (min):"} ) viewof islands = Inputs.checkbox( ["Torgersen", "Biscoe", "Dream"], { value: ["Torgersen", "Biscoe"], label: "Islands:" } ) ``` ```{ojs} penguins .params({ blm: bill_length_min, i: islands }) .filter((d, $) => op.includes($.i, d.island) && d.bill_length_mm > $.blm) .view() ```