Lecture 01: Python for Data Science
- Session: Day 1, Fri 4 Dec 2026, block A 9:00-12:00, Lab 16 (group AI-2)
- Duration: 3 hours, face to face, laptops required
- Prerequisites: basic programming in any language; linear algebra (matrix product, transpose, inverse)
- Before: C1-1 Machine Learning with Python
- Setup:
pip install -r requirements.txtat repo root, before the session
Learning objectives
- Use Python containers, functions and comprehensions to clean and count data, and avoid the mutable-default trap.
- Write vectorised NumPy code, predict broadcast shapes, and derive the pairwise distance identity.
- (Self-study before Day 2) Load, select, group and impute data with pandas.
- 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
notes.md: full notesslides.md: link to the deck (learner and instructor versions)instructor.md: timing cues, misconceptions, what to cut if lateglossary.md: terms in English and Arabicexercises.md: check questions with solutions, lab, extensioncode/lab.py,code/test_lab.py,code/solutions.py,code/figures.py