Python and Instat
Programming…yes, you heard right! It is extremely useful to have an idea of what it can do and how it can help an analysis process (at any level of the game). Around this time last year, FC Python (https://twitter.com/FC_Python) wrote a blog post on why “Programming matters in Sport Science” (https://thevideoanalyst.com/programming-matters-sports-science/). His post hit home a hard realisation as to how much manual labour I was doing in Excel. For my own sanity and work-load management I decided for a change. For the past year, I have through a very slow process had a go at learning Python. It has been a head wrecking journey but extremely beneficial nonetheless. Let me explain.
Luckily enough for me, my day job gives me access to a few different data preparation and manipulation tools (Alteryx and Tableau Prep). While these are extremely useful, they can unfortunately be expensive, and clubs don’t like to spend money…we all know that. With that, analysts are left to use any tools they can find/get access to within their toolbox. This often leads to a lot of heavily lifting without starting actual “analysis” work. Thus, a great use case for programming languages such as R and Python. The reason I chose Python over R was simply due to syntax (language) preference. I’ve also heard (apparently) that Python is a bit more flexible in other areas of programming (hopefully time will tell).
I am very much still a “beginner” when it comes to programming, but I have benefited from this lengthy learning process. Thanks to my good nature now you can too. I honestly believe that it will save analysts a huge amount of time. Instat scout is a football video platform which covers games from all over the world. Its platform allows clubs to do several things (among many others):
- Scout potential players from leagues abroad through video & statistics
- Opposition analysis through video analysis
The reason I wrote this post was to help analysts in football clubs save time. The files from Instat are detailed yet lack completion at times. The script which I have written (link below) looks at combining numerous Excel files (downloaded from the platform) and go through several manipulation processes. Once completed, it can be re-pointed to an existing visualisation. For example, this dashboard (https://public.tableau.com/profile/alex.rathke#!/vizhome/LeagueofIreland2019Season/Story1) is based off Instat files and a Python script.
The script is very easy to follow through the documentation process that I have supplied at each stage along the way. Otherwise one will need the following:
- Download the script (can be accessed on GitHub – https://github.com/guido1992/Parse-Instat-Files).
- Install Jupyter Notebook and imported the script.
- Edit the path file.
- Edit the script to your needs (Season, League, team names etc).
- Check for positions and null filters.
- Change the output name.
- Run the script and a fully edited file should be ready to use.
Hopefully this script is useful and beneficial for analysts who use Instat data. Lastly, get down and dirty….it is well worth the time. Programming takes time to learn but will ultimately save you hours on end with manipulating data to the extend you may need it in.