Showing posts with label Premier League. Show all posts
Showing posts with label Premier League. Show all posts
Saturday, February 14, 2015
Which Premier League match is most exciting to watch on a full match replay?
Living in Los Angeles now means that I'm unfortunately completely out of sync with Premier League football matches. The upside of this is that by the time I get up on the weekend most games have been played and I can watch full match replays on NBC Sports Live Extra. As a mostly neutral fan I'm interested in watching the most exciting games each weekend but there's no way to tell which game I should watch without knowing the final score and therefore spoiling the match (as far as I can tell).
Today I wrote a Python script that returns a list of the most recent round of Premier League games ordered by excitement and without any spoilers. I used the free API at football-data.org. It was my first experience with JSON data and the trickiest part was definitely trying to connect with a remote API for the first time and get the data in a usable dictionary format.
The ranking of the matches is calculated using the formula (total goals)/(difference in goals scored), where a higher number is better. For example, I'd rather watch a tight 2-1 (3/1 = 3) than a one-sided 5-1 (6/4 = 1.5) hiding. The script simply returns a list of matches without any goal information with the first being the most exciting.
The script below can be executed from a browser here: http://rextester.com/SJK63458
Labels:
football-data.org,
Premier League,
Python,
replays,
spoilers
Location:
Los Angeles, CA, USA
Subscribe to:
Posts (Atom)