This is the content of a set of Python courses. For more details see the course outlines. All the links open the Python code in Google Colab, so you can run the code and edit it to experiment with it.
Getting started: lesson and exercise
Data types: lesson and exercise
Strings (and methods, and indexing / slicing): lesson and exercise
The attendee exercise is a consolidation exercise that revises strings, lists and dicts. It is based on a real-life problem of extracting first names from a list of email addresses.
Control flow: lesson and exercise
List comprehensions: lesson and exercise
Data structures exercise. This revises strings, lists and dicts, and has a final brain teaser exercise.
Writing functions: lesson and exercise and another exercise
A very brief look at some common modules and packages:
Install a package: exercise
OpenAI demo connects to ChatGPT to have a conversation.
Read and write Excel files
- a simple starter example
- a more complete example that reads several tables from an Excel file into pandas DataFrames, merges the the tables, summarises the data, creates a chart then exports the summarised data in both CSV and Excel file formats.
Retrieve Data from an API / web pages the requests package
- Police Street Crime Exercise retrieves recent crime incidents in a local area
- COVID Cases examples using requests and then the uk_covid19 SDK
Use the requests package in a practical example to retrieve data from an API of the people currently in space exercise
Functional programming lesson and exercise
Building classes (object-oriented programming) lesson and exercise
If time allows, a very brief look at:
- exceptions,
- type annotations,
- reading or writing files, managing directories with the os and shutil modules
- the re module for regex functionality
The Data Analysis With Python course focusses on data analysis with the numpy, pandas and seaborn packages. The numpy package underpins many data analysis packages (including pandas), and AI packages.
Introduction to data analysis with pandas - tutorial
Introduction to data visualisation with seaborn - tutorial
Retrieving data from SQL - demo
numpy is the foundation of data analysis in Python, and is used for working with arrays and matrices of data.
pandas is the library for data analysis in Python.
- lesson 1 and exercise 1
- lesson 2 and exercise 2
- lesson 3 and exercise 3
- lesson 4 and exercise 4
- titanic exercise
- fx rates example (time-series data)
- league table example
- COVID cases example
Visualise data with the seaborn package.