Arquero

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()
OJS Runtime Error (line 20, column 12)

op is not defined

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.

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:"
  }
)
bill_length_min = 35
islands = Array(2) ["Torgersen", "Biscoe"]
penguins
  .params({
    blm: bill_length_min,
    i: islands
  })
  .filter((d, $) => op.includes($.i, d.island) && d.bill_length_mm > $.blm)
  .view()
OJS Runtime Error (line 48, column 21)

op is not defined