Public
Edited
Feb 5, 2024
Insert cell
Insert cell
{
const dates = new dfd.dateRange({start: "01/01/2023", period: 5, freq: 'M'})
const close = [122.3, 124.55, 125, 120.99, 130]
const data = {
date: dates,
close
}
const d = new dfd.DataFrame(data)

return d['date'].dt.processData

}
Insert cell
{
const sf = new dfd.Series(["1/1/2000", "1/2/2000", "3/3/2000", "1/4/2000", "1/5/2000"])
// const d = new dfd.DataFrame(["1/1/2000", "1/2/2000", "2/3/2000", "1/4/2000", "4/5/2000"])

return sf.dt
// d.monthName().print()
}
Insert cell
{
let data = [[1, 2, 3], [4, 5, 6], [20, 30, 40], [39, 89, 78]]
let cols = ["A", "B", "C"]
let df = new dfd.DataFrame(data, { columns: cols })

const sumx = col => col.reduce((a, b) => a + b, 0)
const mul2 = val => val * 2
const newDf = df.applyMap(mul2, { axis: 1 })

console.log(df.toString())
console.log(newDf.toString())
console.log('end')
}
Insert cell
x = tf.tensor1d([10, 15, 16, 24])
Insert cell
tf.range(0, 6)
.reshape([2,3])
.slice([0, 1])
.array()
Insert cell
{
const t1 = tf.range(0, 6).reshape([2, 3])
const t2 = tf.range(0, 2).reshape([2, 1])

return [t1.arraySync(), t2.arraySync(), tf.randomNormal([2, 3], 3, 1, 'int32').arraySync()]
}
Insert cell
Insert cell
dfd = require("https://cdn.jsdelivr.net/npm/danfojs@1.1.2/lib/bundle.min.js").catch(() => {
window.dfd.Series.prototype.print = window.dfd.DataFrame.prototype.print = function () {
return print(this);
};
return window.dfd;
})
Insert cell
tf = import("https://cdn.skypack.dev/@tensorflow/tfjs-core@4.8.0")
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