Methods: Python programming for economists
Table of Contents
This website contains the material for the MSc course Methods: Python programming for economists.
This website is under construction for 2026/2027
This year the course is taught by:
- Jan Boone
- Tulio Bouzas
- Mery Ferrando
- Joyce Ladenstein
Table of Contents
1. Course Material
1.1. Career Development part of the course
Career development activities (workshops and career events) are part of the course ‘Methods: Python Programming’. The goal of this career development part of the course is to help students from the Master Economics transition into their careers after graduation. The focus is on personal growth and development and provides practical tools to be well prepared for the job application process.
In both semester 1 and semester 2, workshop(s) will be offered by Student Career Services. To pass the course ‘Methods: Python Programming’, you must participate in at least 1 workshop of your choice and at least 1 career event. You will receive a partial grade once you have completed the Python programming part of the course. At the end of the academic year, you will be assessed whether you have met the set criteria of the career development part of the course through a pass or fail. Only with a positive grade for the Python programming part of the course and a pass for the career development part of the course you have passed the course ‘Methods: Python Programming’.
For more information and for an overview of workshops and career events offered throughout the year check the ‘Career Development for MSc Economics’ Canvas page and this file.
1.2. Python part
For the Python part of the course, there are three types of materials that we use:
- the website with the lectures
- the (free) book by Downey (2023)
- Datacamp
The lectures (mandatory)
The website with the lectures are mandatory. Make sure you read the material before each lecture (see lecture schedule below) and solve the Review Questions at the end of each Lecture.
Learning a programming language requires you to try and program yourself. Just copying the code during the lectures is not going to help you very much; if you are only doing this, it is basically a waste of your time.
The important part of this course you do at home going over the lectures, experimenting with the code and trying to solve the Review Questions. This part will most likely be frustrating because you get errors and you make mistakes (i.e. different results than you would expect) etc. Don’t worry, this is normal when you are learning a programming language!
(Downey 2023) (highly recommended)
The lectures are (loosely) based on Downey (2023) which is a great introduction into Python. The book can be found here and the associated notebooks here. The book sometimes uses “wrappers” around the Python functions that we will be using and it is targeted at engineering students. But it does explain the idea of modelling in Python very well and it gives you an introduction to numpy and scipy functions.
Datacamp (optional)
If you have never done any programming before, the three courses below from Datacamp will help you get up to speed. I recommend that you do these courses before the start of the semester. If you have programmed before or done some Datacamp courses already, this part is optional.
You can get access to Datacamp via the university website.
From Datacamp, you can do the following courses:
- Intro: https://www.datacamp.com/courses/intro-to-python-for-data-science
- Intermediate: https://www.datacamp.com/courses/intermediate-python-for-data-science
- Pandas: https://learn.datacamp.com/courses/data-manipulation-with-pandas
These courses teach you the basic Python syntax. In our lectures we use parts of Python more specific to economics; e.g. commands to solve equations, equilibria etc. These parts of the course complement each other. It is not the case that all the Python that we use in the lectures, you will first see in Datacamp but most of it is in Allen Downey’s book.
Most students like Datacamp to get used to Python syntax. A minority of students really dislike Datacamp. If you do not like it, you can also read Think Python as an introduction to “pure” Python (instead of Downey’s modeling and simulation book, mentioned above). You can buy the book or read the free online version. The jupyter notebooks can be found on github. You can clone this repository and work with the notebooks. You can also find some wonderful presentations on Youtube by the author Allen Downey.
2. Lecture schedule
| date | time | staff | room | lecture | Downney |
|---|---|---|---|---|---|
| 2026-08-26 | 12:45-14:30 | Joyce | Cube 219 | ||
| 2026-09-01 | 12:45-14:30 | Jan | Cube 219 | 1 | 1-4 |
| 2026-09-08 | 12:45-14:30 | Mery | Cube 219 | gender economics | |
| 2026-09-15 | 12:45-14:30 | Jan | Cube 217 | 2 | 5-8 |
| 2026-10-12 | 12:45-14:30 | Joyce | Cube 17 | ||
| 2026-10-14 | 14:45-16:30 | Joyce | Cube 213 | ||
| 2026-10-21 | 08:45-10:30 | Jan | CZ 112 | 3 | 11-14 |
| 2026-10-28 | 14:45-16:30 | Joyce | Cube 21 | ||
| 2026-11-04 | 12:45-14:30 | Joyce | E 4 Blackbox | ||
| 2026-11-11 | 08:45-10:30 | Jan | MKZ 111 | 4 | |
| 2026-11-19 | 08:45-10:30 | Jan | MKZ 111 | 5 | |
| 2026-11-25 | 10:45-12:30 | Jan | CZ 9 | 6 | |
| 2026-12-02 | 10:45-12:30 | Jan | Cube 220 | Q&A | |
| 2027-01-04 | deadline assignment | ||||
| 2027-05-10 | deadline resit |
3. First Lecture
- go to
- jupyter lab
- IT suggests that you use the Firefox browser to access jupyter lab
- sometimes it helps to access jupyter lab with an incognito/private window
- if you want to install Python and Marimo on your own computer:
- first install anaconda: https://www.anaconda.com/download
- then install Marimo: https://docs.marimo.io/getting_started/installation/
- if you do not want to use a virtual environment, you can do
pip install "marimo[recommended]"directly in a terminal
- jupyter lab
- create a new python notebook and type the following code in the first cell:
%%bash
git clone https://github.com/janboone/Python-programming-for-economists.git
- then press the Shift key and Enter key at the same time
- this creates a folder on the server
Python-programming-for-economiststhat contains the material for the course.- Note: you can only run this command once. If you run it again, you get an error since the folder already exists.
- In this folder there is a folder
datathat we will use during the lectures - and it contains the file
assignment_template.pywhich contains the template for the final assignment - If there is a ``Marimo tile’’ on the jupyterlab server, you can click this
and are ready to go
- if not, you can install Marimo on jupyterlab yourself: how-to (we will do this together in class)
- click the “Marimo tile” and “Create a new notebook”
- type
5 + 5and then simultaneously the keys Shift and Enter (or click the Run button of the cell) - Python evaluates the cell and returns ``10’’
- type
3.1. Deadlines
- The deadline for the final python assignment is: Monday January 4th, 2027.
- The resit deadline for the python assignment is: Monday May 10th, 2027.
- Your grade is determined by:
- a “pass” on the Career Services assignments;
- the grade of your final assignment.
Follow the instructions below and (to be posted) on Canvas explaining how to submit an assignment and fill in the google form.
Also note the rules for the resit of the final assignment in case you submitted an assignment for the first exam opportunity (you cannot do an app on the same paper/model twice for your assignment).
4. Final Assignment
For this course there is one final assignment. For the deadlines of the final assignment, see 3.1 above.
Note that you can do the assignment alone or with at max. one other student (i.e. max group size is 2).
4.1. what we are looking for
The idea of the final assignment is that you report on an economic model in a transparent way that can easily be verified/reproduced by others. Think of yourself in, say, two years time where you work in a company, bank, consultancy firm or ministry. You need to explain an economic “phenomenon” to your colleagues. Since not all your colleagues are necessarily economists, your goal is to create an interactive (marimo) app. With this app, colleagues can figure out themselves how certain parameters affect the outcome and how sensitive outcomes are to (other) parameter values.
Since future colleagues is a bit vague, think of the intended audience as your fellow students. They should be able to understand the code you write, together with the explanations that you give for this code and for the economics that you are explaining.
The following ingredients will be important when we evaluate your final assignment:
- The topic for the app should come from a theory (i.e. not empirical) paper or a theoretical model that you have seen in class for another course
- Briefly describe what the paper/model does and what the results are that you want to illustrate with the app
- When you use information (e.g. a literature reference), create a (Markdown) link to this information. The reader then only needs to click the link to find the relevant information.
- Then formulate a clear and transparent research question that the user will be able to answer using the app
- Briefly motivate why this question is interesting.
- Use \(\LaTeX\) to introduce and explain the model. Describe the main equations (using \(\LaTeX\)) of the model that you will program in Python.
- Explain how you move from the analytical equations of the paper to Python code.
- We will be looking for at least the following methods in the code:
- code is interactive, e.g. it uses sliders,
- there are agents maximizing payoffs; in the Python code make sure you use optimization methods,
- solve for an equilibrium using Python (with fixed points),
- use a parameter sweep (and pandas to store the results) to show how the results are affected by parameter values.
- Hence, we expect (at least) separate functions
- to define payoffs,
- to calculate equilibrium outcomes,
- to simulate outcomes and store the results in a dataframe.
- Explain your code in Markdown blocks, not as comments in code blocks
- and note that these explanations make sense in both the edit and app views of the marimo notebook
- Present interactive graphs of your simulation results using
matplotliband marimo sliders - Discuss what the figures show (e.g. \(x\) is increasing in \(y\)) and explain the economic intuition for this relation (between \(x\) and \(y\)).
- What can the user learn from the app and the interactive outcomes that follow from it
Remark 1:
- you can copy code from the web or an LLM; but
- make sure that you explain the code that you use so that another student of the course understands it and can use it;
- e.g. if you use functions, libraries that we have not used in the lectures you need to explain these in your notebook
- explain special syntax like
f(*my_list)if you use constructs like this - but there is no need to explain what
np.arangedoes: we use this extensively in class - give the reference of the code that you copy or acknowledge the use of an LLM
- check the code and explain the economics of your results yourself; do not rely on the LLM only. To illustrate this, look at the page LLM. This page was generated using an LLM. However, if you would copy/paste the answers given by the LLM, you would fail your final assignment. Look at this page critically and find where the LLM’s answers are ``less than optimal’’.
Remark 2:
- the apps we create in the lectures do actually not satisfy the criteria for the final assignment:
- either there is no optimization problem that is solved with python (e.g. in the Cournot example we derived the reaction functions analytically)
- or there is no equilibrium derived (e.g. see the Solow model app)
- the app based on the gender economics lecture does have all the elements that we are looking for in the final assignment
4.2. resit of final assignment
The resit of the final assignment needs to start from a new paper/model compared to the one you handed in before. Simply adjusting your first submission based on our feedback will be not be enough.
Otherwise, follow the procedure above on how to submit the assignment and fill in the google form.