Public
Edited
Jun 1, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
myArray = [
{
e: "trade",
E: 1717200034326,
s: "BTCUSDT",
t: 3620990564,
p: "67564.76000000",
q: "0.01479000",
b: 27555370502,
a: 27555369806,
T: 1717200034326,
m: false,
M: true
}
]
Insert cell
Insert cell
Inputs.table(myArray)
Insert cell
Insert cell
myTransposedArray = transposeArray(myArray)
Insert cell
Insert cell
Inputs.table(myTransposedArray)
Insert cell
Insert cell
Insert cell
myTransposedArray_withCustomColumnNames = transposeArray(
myArray, {
col1Name: "Mysterious Letters",
col2Name: "Value"
})
Insert cell
Inputs.table(myTransposedArray_withCustomColumnNames)
Insert cell
Insert cell
function transposeArray(array, {
col1Name = "key",
col2Name = "value"
} = {}) {
return aq.from(array)
.fold( Object.keys(array[0]) )
.rename({key: col1Name})
.rename({value: col2Name})
.objects()
}
Insert cell
Insert cell
import {Wrangler, op} from "@observablehq/data-wrangler"
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