Lecture 01: Python for Data Science

Learning objectives

  1. Use Python containers, functions and comprehensions to clean and count data, and avoid the mutable-default trap.
  2. Write vectorised NumPy code, predict broadcast shapes, and derive the pairwise distance identity.
  3. (Self-study before Day 2) Load, select, group and impute data with pandas.
  4. Derive the normal equations and fit linear regression in NumPy, matching scikit-learn.

Sections

# Section Minutes
0 Setup check and recall quiz 15
1 Python core for data work, concept question 1 25
2 NumPy: vectorisation, broadcasting, distances, concept question 2 50
- Break 10
4 Least squares in NumPy, concept question 3 35
5 Practice (P.1 to P.3), lab core, exit ticket 45
3 pandas: self-study before Day 2 30 at home

Changed after the review of 24 Nov: four large topics did not fit three hours for novices, so pandas moved to self-study and NumPy and least squares gained practice time.

Materials