Public
Edited
Oct 11, 2023
Fork of Simple D3
1 fork
Insert cell
//read in data from soccer dataset
data = (await FileAttachment('season-1819_csv.csv').csv())
.map(season_1819 => {
// create a function to parese strings into Dates
// const parser = d3.timeParse('%Y-%m-%d');
// //assign dates
// season_1819['Date'] = parser(season_1819['Date']);

season_1819.team = data[]
// remove columns that we are not using it -- what I need to do is drastically filter down the data and then dothis operation for every season
// delete season_1819["Div"];
// delete season_1819['Date'];
return season_1819;
} )
Insert cell
const calc_points = function calcPoints(FTR) {
if (FTR == 'H'){FTR =3}
else if (FTR == 'D') {FTR = 1}
else if (FTR == 'A') {FTR = 0}
else {FTR = null}
}

seasonthis = season_1819.map(season => {
season['team'] = season_1819['HomeTeam'];
season['goals for'] = season_1819['FTHG'];
season['goals against'] = season_1819['FTAG'];
season['points'] = calc_points(season_1819['FTR']);
return season
} )
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