Published
Edited
Oct 18, 2020
2 stars
Insert cell
md`# fizzbuzz ML`
Insert cell
fizzbuzz = (i) => {
let str = ''

if (i % 3 === 0) str += 'fizz'
if (i % 5 === 0) str += 'buzz'
if (str === '') str = `${i}`

return str
}
Insert cell
_ = require("lodash")
Insert cell
numbers = _.sampleSize(_.range(1, 1_001), 100)
Insert cell
examples = numbers.map(n => [n, fizzbuzz(n)])
Insert cell
dfd = require('danfojs@0.0.15/dist/index.min.js').catch(() => {
window.dfd.Series.prototype.print = window.dfd.DataFrame.prototype.print = function() { return print(this) }
return window.dfd;
})
Insert cell
Insert cell
a = new dfd.DataFrame(examples)
Insert cell
a.print()
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more