Loading Data for Premier League xG for teams from 21-22 season
This example demonstrates the loading process for Premier League expected goals (xG) data from the 21-22 season, sourced from Understat. The visualization displays the raw CSV data as a JSON-formatted table within a `<pre>` element, showing each team’s categorical name alongside quantitative values for matchweek, expected points (xP), actual points, and league table position based on xP. The code fetches the CSV file asynchronously, parses it with `d3.csvParse`, converts numeric strings to numbers, and renders the state using d3’s selection and join operations. The interface initializes with a loading state before populating the data table.
AI-generated descriptionThis data comes from: https://understat.com/
Variables and their types:
Team (categorical): A Premier League Team
Matchweek (quantitative): Which week in the 38 week season the game occured
xP (quantitative): A probability that corresponds to the expected amount of points a team has accumulated so far in the season
Points (quantitative): The number of points gained in the game so far in the season
xPTable (quantitative): The position in the PL table a team would be based on their xP