Whether you call it soccer or football, this sport is the world's favorite to watch and play. Thanks to Hugo Mathien who compiled, cleaned, and shared a dataset of stats on European professional football on Kaggle, it can become a data scientist's favorite playground, too. Among other data points, the database includes 25,000+ matches from 2008 to 2011, 10,000+ players from 11 countries, and betting odds from up to 10 providers. This impressive collection of data allows Kagglers test their machine learning techniques by building models predicting match outcomes (can you beat the bookies?) and find insights through data visualization and storytelling.

If you have a dataset you'd like to share, you can publish it on our open data platform! And if you're an explorer type, you can create kernels on any of the publicly available datasets to build your data science portfolio.

Deep in the data

Could you tell our readers a little bit about this dataset?

The dataset comes in the form of an SQL database and contains statistics of about 25,000 football matches, from the top football league of 11 European Countries. It covers seasons from 2008 to 2016 and contains match statistics (i.e: scores, corners, fouls etc...) as well as the team formations, with player names and a pair of coordinates to indicate their position on the pitch.

The dataset also has a set of about 35 statistics for each player, derived from EA Sports' FIFA video games. It is not just the stats that come with a new version of the game but also the weekly updates. So for instance if a player has performed poorly over a period of time and his stats get impacted in FIFA, you would normally see the same in the dataset.

What motivated you to share these data with the Kaggle community?

I found the data collection to be a long and tiring work. I wished no one would ever have to do the same again, hence why I decided to share my work with the community.

Also I am hoping people will help grow this dataset by adding more leagues, national and international cups and keep the dataset updated with the upcoming matches.

Finally, I hope someone will find a way to beat the odds and predict match results with good accuracy. Maybe someone did already but ran away with the money!

Can you tell us about how you collected and cleaned the data?

I used Python and a library called Scrapy to scrape data from two websites. I gathered match data from enetscores.com and FIFA statistics from sofifa.com

The difficult part was to map the players' profiles obtained with the match data to their profile on the “sofifa” website. They had no “key” in common other than their name and birthday. So I started off with a list of all the unique players that were in my match dataset. I would loop through the list and each time search for the corresponding player in sofifa.com. I was left with thousands of players I couldn’t find, because the name and/or birthday don’t match between the two websites. It is quite common for Brazilian and Portuguese players who have multiples names or nicknames. Cristiano Ronaldo for instance, some may call him C. Ronaldo, Ronaldo... or even his full name Cristiano Ronaldo dos Santos Aveiro!

So instead of searching on the sofifa website, I used a mix of three search engines (Google, Bing and Yahoo). Their first result would usually be the right player even if his name is spelled differently. Unfortunately there are still a bunch of players I am unable to find and I would greatly appreciate the help of the community.

What advice do you have for anyone interested in building a dataset from publicly available, but difficult to use data?

I would say it is always good to get something done quickly, even if it’s something small. In fact, it is better to aim for something small at first, for example starting with a subset of data - here it would be “one match” - and a limited set of features. Once you have got something working, it’s motivating and the rest follows in no time.

Kaggler analyses

Tell us about your favorite script (so far!) made using the data...

I like The Most Predictable League by Yoni Lev. It is interesting to see that most top European leagues are becoming more predictable, with the increased dominance of one or two teams (Juventus, PSG, Barca/Real, Bayern/Dortmund). Surprisingly, the English Premier League may be becoming less predictable - we’ve seen it last year with Leicester FC.

What's the most interesting or insightful thing you've learned about the data?

First, that the probability of a home win far exceeds away win. It is intuitive for every football fan, the team playing at home always has an advantage, yet I was surprised to see how much this is true. Some leagues have close to 50% probability for home win vs 25% for draw and same for away win!

Using the team formations is also very insightful. A team regularly changing its squad formation has less chances to win. I like to think it’s because having a stable identity helps build a strong team play (think about Barcelona’s 4-3-3 or the Italian’s 3-5-2).

I’m curious about the betting odds data. Do you think it’s possible Kagglers could find evidence of shady dealings or rigged matches?

Definitely 🙂 ! As long as my favourite team (Olympique Lyonnais) is not involved then that’s fine!

For fun!

Who are your favorite teams and what would you be interested to learn about their history?

Olympique Lyonnais and the French national team. I’d love to know what we need to beat PSG and the English respectively.

How would you like to see this data used? Are there any burning questions you’re interested in knowing the answers to?

I would love to see a model that suggests which squad and formation to use against a specific team. And hear Jose Mourinho uses it at Man United.

If you could make any other data freely available for analysis, what would it be?

It would be about clicks on Wikipedia. I often find myself jumping to another article before I have finished reading the page I originally came to visit. And after few minutes the page am on seems to have no logical connection with my first reading... I am sure there is some nice insights to be made, something like a “cartography of knowledge and learning process”.

My name is Hugo, French citizen living and working in London (UK). I have been working in financial markets (trading) for the last three years. At work I spend a lot of time crunching numbers, looking for trading patterns and making sure we trade the right stocks in right quantity! That's what got me into looking at the broader spectrum of data science and improve my skills in areas such as machine learning, data visualisation and programming.

When am not at work, I enjoy attending live sport events, football of course but literally every sport. The last three months have been great as I got to see Lionel Messi playing at Camp Nou, Cristiano Ronaldo with Portugal and France home win vs Ireland, both at Euro 2016. I am always keen to watch other disciplines. I got to see several big rugby games and remember going to the women basketball and football finals at the Olympics in 2012 - both won by team USA! Next year I want to see American football, NBA basketball and UFC, lucky enough they do exhibition in London so I won't have to go very far!