3 min read

Computer Friday: Python workshop at FAIR, March 23-24

(Schedule-change on 2023-03-20 so as not to crash with the emerging researcher seminar series.)

Python is one of the most popular general purpose programming languages. It is also one of the most popular languages for “data science” in both business and academia. It can be used for everything from simple house-holding tasks to symbolic and numerical maths. The modern standard for programming interactive experiments, o-Tree, is also a Python framework. At FAIR, Python is used for implementing experiments, estimating models, brute force solving of symbolic math problems, keeping track of administrative actions, and for everyday minor automation.

At FAIR we believe that everyone should have some exposure and experience with a general purpose programming language, it is not necessary to be an expert at programming (or in a particular programming language) to be useful. The idea of the workshop is to be together in way that is sufficiently intense for everyone to get started and practice writing a bit of Python using their own computer; we want to encourage everyone to think about automating boring tasks, and develop their own skills. No prior experience with Python is necessary, if you have experience writing do-files or R-scripts, you should be sufficently prepared!

The philosophy of the workshop is to start with basic Python constructs and explore what we can do with even very basic Python. Often there will be very elaborate libraries available that can solve tasks very efficiently, but getting to know these libraries can feel overwhelming. We start from scratch, and then only later will indicate how adopting efficient libraries can speed up both the writing and the execution of programs.


It is difficult to fit a full one-day workshop into the schedule at FAIR, and instead the plan is to split the workshop over two consecutive days.

There will also be a pre-workshop session to help everyone get Python and necessary tools installed on their computer such that it is possible to actively follow the workshop.

  1. Introduction. Thursday 2023-03-23 at 0900-1100 in FAIR-1. Getting started with Python, basic syntax. Motivating example: How to get Python to solve general nonlinear equations of one variable.
  2. Input and output. Thursday 2023-03-23 at 1330-1530 in FAIR-1. How to read and write data from disk. Running example: How to read data from an experiment, match participants, draw payments and write payment file to disk.
  3. Building simple data structures. Friday 2023-03-24 at 1330-1530 in FAIR-1. Building larger structures depend on breaking things down (more smaller pieces) but also bundling different pieces of data together (fewer but larger pieces). Running example: How to bundle numbers into vectors and matrices for simple linear algebra operations.

At a later occasion (to be determined), we will follow up with a session on

  • What are “libraries” and how are they useful. Looking at the examples from sessions 1-3, is it possible to rely on the work of experts such that we can write more succinct and efficient code? Yes! We’ll look at some of the popular libraries that would have been very useful for solving the example tasks from the workshop.