Phase 01
4–6 weeks
0 / 6 complete
Python and engineering foundations
Outcome: Write reliable programs, inspect errors, and manage a small project without following a tutorial line by line.
01.1Python, data types, and control flow
Exactly what it is
Python is a programming language used to express a repeatable sequence of instructions. Variables store values; data types describe those values; conditions and loops control which instructions run.
Why you should learn it
Data work contains repeated tasks: reading files, correcting values, calculating metrics, and producing reports. Code makes the same process fast, reviewable, and repeatable.
Real-world use case
An operations analyst receives daily order files. A Python program validates every row, calculates revenue, and flags negative quantities before the report is sent.
Learn in this order
- 1.Learn strings, numbers, booleans, lists, dictionaries, sets, and tuples.
- 2.Use if/elif/else for decisions and loops for repeated work.
- 3.Write small functions with clear inputs and return values.
- 4.Use comprehensions only when they remain easy to read.
Common mistakes
- Using one long script instead of small functions
- Changing a list while looping over it
- Choosing a list when fast unique lookup needs a set
orders = [
{"status": "complete", "qty": 2, "price": 450},
{"status": "cancelled", "qty": 1, "price": 900},
]
def completed_revenue(rows):
valid = [r for r in rows if r["status"] == "complete" and r["qty"] > 0]
return sum(r["qty"] * r["price"] for r in valid)
print(completed_revenue(orders))Output: Output: 900. Cancelled orders and invalid quantities do not enter the total.
Practice task
Read a list of transactions and return total sales, cancelled count, and the highest-value valid order.
01.2Errors, testing, and reproducible environments
Exactly what it is
Exceptions report failures. Tests check expected behaviour automatically. A virtual environment gives each project its own package versions so one project cannot silently break another.
Why you should learn it
Real input is incomplete and inconsistent. Professional code must fail clearly, protect valid results, and behave the same on another machine.
Real-world use case
A currency column sometimes contains 'N/A'. Instead of crashing halfway through payroll, the program records the bad row and continues with an auditable error report.
Learn in this order
- 1.Read tracebacks from the final line upward.
- 2.Catch only errors you can handle; never hide every exception.
- 3.Validate assumptions at the boundary of a program.
- 4.Create focused tests for normal, empty, missing, and invalid input.
Common mistakes
- Using except: pass and losing the cause
- Installing every package globally
- Testing only the happy path
def parse_amount(value):
if value is None or value == "":
return None
try:
amount = float(value)
except (TypeError, ValueError) as error:
raise ValueError(f"Invalid amount: {value}") from error
return amountOutput: Missing values remain missing; malformed values raise a useful error instead of silently becoming zero.
Practice task
Write and test a CSV amount parser for valid numbers, blanks, text, negative values, and very large values.
01.3Git, terminal, and project structure
Exactly what it is
Git records versions of your work. The terminal runs tools directly. A project structure separates source code, tests, data references, configuration, and documentation.
Why you should learn it
Teams must review changes, reproduce results, recover older versions, and work in parallel without emailing notebooks named final_v7.
Real-world use case
Two analysts improve different parts of a churn project. Git shows exactly what each changed and allows a safe review before combining their work.
Learn in this order
- 1.Learn pwd, ls, cd, mkdir, and basic file operations.
- 2.Use git status, add, commit, branch, pull, and push.
- 3.Never commit credentials, private customer data, or large generated files.
- 4.Write a README with setup, inputs, commands, and expected output.
Common mistakes
- One giant commit after a week of work
- Committing API keys
- Keeping code only inside an unstructured notebook
Practice task
Publish an expense tracker with source code, tests, sample data, a dependency file, and a clear README.
01.4Object-oriented design, modules, and clean code
Exactly what it is
Classes group data with the behaviour that belongs to it. Modules split code into files with a single responsibility. Clean code uses clear names, small functions, and type hints so others can read it quickly.
Why you should learn it
Data projects grow from one notebook into pipelines, APIs, and shared libraries. Without structure, every change becomes risky and slow.
Real-world use case
A fraud team builds a reusable FeatureBuilder class. Every model imports it, so features are calculated the same way in training and in production.
Learn in this order
- 1.Learn classes, __init__, methods, and dataclasses.
- 2.Add type hints and run a type checker such as mypy.
- 3.Move reusable logic from notebooks into .py modules.
- 4.Format with black or ruff and follow PEP 8 naming.
Common mistakes
- Creating classes for everything when a function is enough
- Leaving business logic only inside notebooks
- Names like df2, temp, and final_data
from dataclasses import dataclass
@dataclass
class Customer:
orders: int
total_spent: float
def average_order_value(self) -> float:
return self.total_spent / self.orders if self.orders else 0.0
print(Customer(orders=4, total_spent=2000).average_order_value())Output: Output: 500.0. Zero orders return 0.0 instead of a division error.
Practice task
Convert one of your notebooks into a package with a module for loading, one for cleaning, and one test file.
01.5Working with files, JSON, and APIs
Exactly what it is
Real data arrives as CSV, Excel, JSON, and responses from web APIs. An API is a URL that returns structured data when you send a request, often with a key and page limits.
Why you should learn it
Much business data never sits in a clean table. You must collect it safely, respect rate limits, and store it in a usable format.
Real-world use case
A marketing analyst pulls daily campaign spend from an advertising API, handles pagination, and saves each day as a dated file for reporting.
Learn in this order
- 1.Read and write CSV and JSON with the standard library and pandas.
- 2.Use requests with timeouts and check status codes.
- 3.Handle pagination and retry temporary failures with backoff.
- 4.Keep API keys in environment variables, never in code.
Common mistakes
- No timeout, so the program hangs forever
- Committing API keys to Git
- Ignoring pagination and loading only the first page
import os, time, requests
def fetch(url, retries=3):
headers = {"Authorization": f"Bearer {os.environ['API_KEY']}"}
for attempt in range(retries):
r = requests.get(url, headers=headers, timeout=10)
if r.status_code == 429:
time.sleep(2 ** attempt)
continue
r.raise_for_status()
return r.json()
raise RuntimeError("Rate limit not cleared")Output: Temporary rate limits are retried with growing waits; real errors stop the program clearly.
Practice task
Collect data from a free public API (weather or exchange rates) for 30 days and save it as a clean table.
Reliable expense analyser
Build a command-line program that reads transaction CSV files, validates the schema, categorises spending, and creates a monthly summary.
Deliverables
- Reusable functions rather than one long script
- Tests for invalid dates, missing amounts, and duplicate rows
- Sample input and expected output
- README with setup and decisions
- Write a 100–150 line program independently
- Explain a traceback and fix the root cause
- Create a clean repository another person can run
Optional further study