Public
Edited
Mar 20, 2023
Insert cell
Insert cell
db = DuckDBClient.of({
teams:FileAttachment("Teams.csv")
})
Insert cell
Insert cell
Plot.plot({
axis: null,
margin: 20,
marginRight: 320,
marks: [
Plot.tree(data, {path: "name", delimiter: "#"})
]
})
Insert cell
db
SELECT name,yearID,lgID,divID
FROM teams
ORDER BY lgID,divID,name
Insert cell
teams
Insert cell
teamsFilt = teams.filter(d => d.yearID == season)
Insert cell
data = {
const data = [
{name:"MLB"}
]
for(let i = 0; i < teamsFilt.length; i = i + 1){
data.push({name:`MLB#${teamsFilt[i].lgID}#${teamsFilt[i].divID}#${teamsFilt[i].name}`.replace("#null#","#")})
}
return data
}
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