Full disclosure, I’m a terrible FIFA player and I’ve always been. It is something that would not bother me at all if not for the fact that all my friends love playing FIFA and I’m really tired of loosing. So, some weeks ago I decided to spend some time trying to get an edge using basic data analysis on FIFA players and teams. I’m not saying that you are going to win if you read this article but at least you will have the best team possible and look like you know what you are doing.
“I hate losing more than I love winning.”
— Billy Bean, Moneyball
Taking and preparing the data
First, I had to find the data I needed to do the analysis, and luckily I could find a dataset in Kaggle with around 18000 players and more than 350 teams with their stats from FIFA19, good start.
After importing the data to my Jupyter Notebook and taking a quick look at it, I saw that I had way too many information and should take out some to make the process easier. Quick and easy with a df.drop().
Then, I decided to select my team, so, I grouped all the players by their team and I choose to order them taking the Overall variable as it is a good measure of the players' ability.
And the result was… Drum roll…
As we can see, Juventus has the best players, followed by Napoli, Inter, Barça and Real Madrid. Nice! Now I know the team that I should choose. But, what lineup should I select?
This one is a bit more tricky because some players have the same overall value and we can only choose 11. So, we have to take a look at other values. To select the values we need to choose for each position, I checked a page named Mulefactory where I found everything I needed. Apparently, I should choose a goalkeeper with strong diving, reflexes, positioning, and handling it. For the defenders, defending (duh), pace and physical and so on.
Now to the code. We need to take only the players from Juventus, then I had to add a new column with the real positions of the players because the one in the dataset is not correct and the group by position to compare them.
Now we just have to select the players we want according to their stats. And here we have the best team in FIFA19!!
Now I’m ready to beat all my friends this weekend. : )
You can check the full code and presentation in my GitHub.