Public
Edited
Feb 19, 2023
Insert cell
Insert cell
massey_teams = fetch(
"https://corsproxy.io/?https://masseyratings.com/scores.php?s=384031&sub=384031&all=1&mode=3&format=2"
).then(async function (r) {
let text = await r.text();
let data = d3.csvParse("massey_id,massey_name\n" + text, function (o) {
o.massey_id = parseInt(o.massey_id);
o.massey_name = o.massey_name.trim();
return o;
});
return data;
})
Insert cell
Insert cell
raw_massey_games = fetch(
"https://corsproxy.io/?https://masseyratings.com/scores.php?s=384031&sub=384031&all=1&mode=3&format=1"
).then(async function (r) {
let text = await r.text();
let data = d3.csvParse(
"day,date,team1,home1,score1,team2,home2,score2\n" + text,
d3.autoType
);
data.forEach(function (g) {
g.team1 = +g.team1;
g.team2 = +g.team2;
});
return data;
})
Insert cell
Insert cell
B1G = {
let grouped = d3.group(massey_teams, (o) => o.massey_name);
return [
"Illinois",
"Indiana",
"Iowa",
"Maryland",
"Michigan",
"Michigan_St",
"Minnesota",
"Nebraska",
"Northwestern",
"Ohio_St",
"Penn_St",
"Purdue",
"Rutgers",
"Wisconsin"
].map((s, i) => Object.assign({ idx: i }, grouped.get(s)[0]));
}
Insert cell
Insert cell
B1GGames = {
let B1GIds = B1G.map((t) => t.massey_id);
let B1GGames = raw_massey_games.filter(
(game) => B1GIds.indexOf(game.team1) > -1 && B1GIds.indexOf(game.team2) > -1
);
B1GGames.forEach(function (g) {
delete g.day;
g.date = d3.utcParse("%Y%m%d")(g.date);
g.home1 = +g.home1;
g.home2 = +g.home2;
g.score1 = +g.score1;
g.score2 = +g.score2;
g.name1 = B1G.filter((t) => t.massey_id == g.team1)[0].massey_name;
g.name2 = B1G.filter((t) => t.massey_id == g.team2)[0].massey_name;
g.idx1 = B1G.filter((t) => t.massey_id == g.team1)[0].idx;
g.idx2 = B1G.filter((t) => t.massey_id == g.team2)[0].idx;
});
return B1GGames;
}
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