Code
A code node never runs on Ridgital’s servers. The browser runs it in a
separate worker and stops it after 120 seconds. Its inputs are the nodes
whose names appear in the code (or those listed in inputs).
python
Pyodide 0.27.2 with pandas and NumPy, loaded on the
first Python node (tens of megabytes, cached by the browser afterwards).
Inputs are pandas DataFrames named after their nodes; the result is the
variable out — a DataFrame, a dict of lists or a list of dicts.
smoothed:
python: |
out = wages.assign(wage_3y=wages.wage.rolling(3).mean())
typescript
Compiled in the browser and run as a function over arrays of row objects
named after their nodes. It returns rows (an array of objects) or
{ columns, rows }. fetch, XMLHttpRequest, WebSocket and
importScripts are not available.
growth:
typescript: |
return wages.map((r, i) => ({ ...r, growth: i ? r.wage / wages[i - 1].wage - 1 : null }));
Options
Written as a mapping, a code step takes:
| Option | Meaning |
|---|---|
code | The source. |
inputs | The nodes it reads, instead of finding them by name in the code. |
A chart or map of a code node is drawn in the browser too.