Linear Programming Fantasy Football

math

There are 13 weeks to go to the end of the Premier League Season and with missed games due to Covid-19, there is bound to be double gameweeks from now to the end of the season. This means that there is an opportunity to catch up in Fantasy Premier League. I looked up solutions that would help me pick a team and I found one that seemed to be perfect for my use case.

However I have made some edits to suit my use case better. This code helps me to pick an optimal team for next week’s fixtures, by comparing the strengths of the two teams in a fixture and applying a multiplier to the expected points of each player. The plan is to use it along with a Free Hit so that I can maximise my points for that week.

To use this code, you will need to have player data which can you can get from here and the next week’s fixture data which you can get from here. By adding ?event=26, you are able to query fixtures for Gameweek 26.

Here is the link to the Google Colab file.

And this is the link to the original file I referenced from.

Cleaning the data differently affects what the code will optimise for and will in turn affect the results and that makes all the difference.