Sport Informatics and Analytics/Pattern Recognition/Python

Introduction
This topic develops issues raised in Pattern Recognition, Theme 2 of this  course. It starts a conversation about the use of Python, a dynamic, general purpose programming language, in sport analytics.

Guido van Rossum compiled a history of Python in blog posts written between 2009 and 2013. In this blog, I will shine the spotlight on Python's history. In particular, how Python was developed, major influences in its design, mistakes made, lessons learned, and future directions for the language.

There is a detailed description of Python on this Wikipedia page.

A growing number of sport analytics practitioners combine Python and R in their work. We introduce you to both platforms in this course. Your choice or combination of either language can be guided by these questions posed by Kevin Markham :
 * Do you have experience of programming in other languages?
 * Are you working in academia or industry?
 * Machine learning or statistical learning?
 * Gentle introduction?
 * Data exploration focus?
 * Data cleaning focus?
 * Data visualisation priorities?

Ana Crisan observes of these questions: If you are capable of thinking about your problem in abstract terms (and thinking statistically is, to me, generalized and abstract terms), then the choice of language has little baring. While there is always some fussing about to get accustomed to a language's nuances, and there are some benefits of one languages over another, the truth is if you know how to analyze data you know how to find what you need within a language.

In this course we encourage you to keep an open mind about the tools you use to analyse performance but are keen to support your use of Python and R.

Florencia D'Andrea (2019) helped with some of these choices with the publication of Python tutorial resources that includes an R bootcamp. Oleksil Kharkovyna (2019) has shared a beginner's guide to Python to extend the choices you have when you use Python. Costas Andreou (2020) describes how to use the xlwings python library to connect with Excel VBA to enable the passing of data between both platforms.

Learning Python
If you are new to programming, there are lots of open resources to help you on your learning journey.

Python.org has an introduction to Python that presents the reader informally to the basic concepts and features of the Python language and system. The authors suggest that after the introduction "you will be able to read and write Python modules and programs, and you will be ready to learn more about the various Python library modules"

Ola Sendecka has created a series of video tutorials that you might find to be a gentle introduction.

See, for example, a guide to the Command Line

Her second video introduces Python.

Other tutorials in the series (Coding is for Girls) include:
 * Python basics
 * Dictionaries
 * Comparisons
 * Saving files and 'if' statements
 * Functions
 * User input and dealing with errors
 * Documentation
 * Reading and writing files
 * Reading data from csv file

There is a Django Girls tutorial that you might find of interest that provides a step by step introduction that leads to the production of your own website.

Ben Hamner and Elena Kirzhner, among others, have provided an introduction to visualisation with Python.

Al Sweigart has made available an online introduction to Python for beginners.

FC Python provides an example of using association football to introduce Python basics.

Using Python in sport contexts
Researchers in sport have used Python in a variety of contexts. Some of them are presented here as case studies.