Module 0: Python Foundations for Data Work
The hands-on notebooks for this module are not available yet.
Overview
The Python you need for the rest of the course: core syntax and data structures, control flow and functions, packages and environments, working with tables in pandas, and getting data into Python from files (CSV, Excel, Stata, Parquet) and from an API.
Estimated time: 4–6 hours, self-paced, before the course starts
Learning objectives
By the end of this module, you should be able to:
- Write and run Python code in JupyterLab using the course environment.
- Use Python’s core data structures (lists, dictionaries, tuples) and control flow (loops, conditions).
- Organise code into functions and modules, and manage packages in a conda environment.
- Load data from files (CSV, Excel, Stata, Parquet) and from an API into pandas, then select, filter, group and summarise it.
- Recognise when a dataset is too large for pandas, and use simple techniques such as chunks and column selection to cope.
Before class
Install the course environment by following the Python environment setup.
Prerequisites: none in Python. You should already be comfortable with data analysis in another tool, such as SPSS, Stata, R or Excel.
Lecture slides
This is a self-study module, so it has no lecture slides.
Hands-on
Until the notebooks are ready, use one of these Python refreshers:
Exercises
To be added.
Further reading
- pandas: 10 minutes to pandas
- pandas comparison with SPSS and with Stata: useful if you are coming from those tools