Okay, so I wanted to mess around with some historical Premier League data, specifically the 1997/98 season. I’ve always been a huge football fan, and that season was a classic! Arsenal winning the double, the drama of the relegation battle… pure gold. So, I wanted to recreate that final league table myself.

Getting Started
First things first, I needed the data. I mean, I wasn’t going to manually input every single result, was I? No way. I started by searching the web to find a reliable source of data of every match’s results.
Finding and Fixing the Data
The raw data were found on the net. It contains every match details, including home team, away team, home goals, away goals, even referees.
After finding the data, I put them into a format, like a spreadsheet. This made it way easier to work with.
The Process
Then, I started writing a super basic script. Nothing fancy, just something that could:
- Read the data I’d gathered.
- Calculate points for each match (3 for a win, 1 for a draw, 0 for a loss).
- Keep track of goals scored, goals conceded, and goal difference for each team.
- Sort the teams based on points, then goal difference, then goals scored (just like the real Premier League).
I fired up my trusty code editor, and got to work. I used a super simple approach. I created a structure to represent each team, storing their name, wins, draws, losses, goals for, goals against, and points.

Then, I looped through my data set, updating each team’s stats based on the result of each match. It was pretty straightforward, actually. If a team won, I added 3 points to their total and incremented their win count. A draw meant 1 point each, and a loss, well, nothing.
I also kept track of the goals. Each team’s “goals for” went up by the number of goals they scored in the match, and their “goals against” went up by the number of goals they conceded.
Sorting and Displaying
Once I’d processed all the matches, the final step was to sort the teams. The sorting logic followed to premier league rules.
Finally, I displayed everything, the sorted table! It showed the team name, games played, wins, draws, losses, goals for, goals against, goal difference, and points.
Seeing that final table pop up, matching the official 1997/98 Premier League table, was pretty satisfying. It’s one thing to look at the historical data, but it’s another to recreate it yourself from scratch.
