I am fairly new to the JavaScript world so please bear with me. I have come across the JavaScript library Arquero which I would like to use in a standalone html file. According to the documentation, it seems like it should be possible. They give a short example code (see below), which is intended to be used in Node.js environment (at least that is how I understood it), but I am unable to reproduce this in browser. How should I construct this script in a plain html?
// <script src="https://cdn.jsdelivr.net/npm/arquero@latest"></script> // this is to reference the Arquero library
import { all, desc, op, table } from 'arquero';
// Average hours of sunshine per month, from https://usclimatedata.com/.
const dt = table({
'Seattle': [69,108,178,207,253,268,312,281,221,142,72,52],
'Chicago': [135,136,187,215,281,311,318,283,226,193,113,106],
'San Francisco': [165,182,251,281,314,330,300,272,267,243,189,156]
});
// Sorted differences between Seattle and Chicago.
// Table expressions use arrow function syntax.
dt.derive({
month: d => op.row_number(),
diff: d => d.Seattle - d.Chicago
})
.select('month', 'diff')
.orderby(desc('diff'))
.print();
As the docs specify:
Arquero will be imported into the
aqglobal object
So to make use of the functions you need to prefix them with aq.
// Average hours of sunshine per month, from https://usclimatedata.com/.
const dt = aq.table({
'Seattle': [69,108,178,207,253,268,312,281,221,142,72,52],
'Chicago': [135,136,187,215,281,311,318,283,226,193,113,106],
'San Francisco': [165,182,251,281,314,330,300,272,267,243,189,156]
});
// Sorted differences between Seattle and Chicago.
// Table expressions use arrow function syntax.
dt.derive({
month: d => aq.op.row_number(),
diff: d => d.Seattle - d.Chicago
})
.select('month', 'diff')
.orderby(aq.desc('diff'))
.print();
<script src="https://cdn.jsdelivr.net/npm/arquero@latest"></script>