Published
Edited
Apr 29, 2021
2 forks
8 stars
Insert cell
Insert cell
Insert cell
arrow = (await require(`arrow-wasm@${version}`))({
importHook: (file) => `https://cdn.jsdelivr.net/npm/arrow-wasm@${version}/dist/${file}`
})
Insert cell
Insert cell
// get arrow file as Uint8Array
contents = {
const response = await fetch(url);
const data = await response.arrayBuffer();
return new Uint8Array(data);
}
Insert cell
Insert cell
// Create a table from IPC format.
table = arrow.Table.from(contents)
Insert cell
// Serialize a table back into the IPC format.
table.serialize()
Insert cell
Insert cell
table.schema.toJSON()
Insert cell
batch = table.recordBatch(0)
Insert cell
batch.numRows
Insert cell
Insert cell
vec = batch.column(1).asFloat32Vector()
Insert cell
vec.sum()
Insert cell
Insert cell
vec.toArray()
Insert cell
Insert cell
vec.view()
Insert cell
Insert cell
{
const raw = vec.toRaw();
return {
array: raw.array,
schema: raw.schema
};
}
Insert cell
Insert cell
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