Week 1 — Environment & Language Basics · ~50 min

Why analysts learn Python & setting up

Free preview

What you'll learn this week

  1. Install Python 3.12+, VS Code and Jupyter, and prove they work
  2. Run code two ways — notebook cells and a .py script — and explain execution order
  3. Use variables and the core types: int, float, str, bool, None
  4. Convert between types and explain why "2" is not 2
  5. Format output with f-strings: thousands separators, decimals, percentages
  6. Read an error message bottom-up and trace a program's state
  7. Ship a calculator that validates its input before it calculates

You already analyse data. Why add Python?

In Module 1 you cleaned data in Excel, modelled it in Power BI and queried it with SQL. Those tools are excellent — and each has a ceiling:

ProblemSpreadsheetPython
Repeat last month's cleaning on this month's fileRedo the clicks, hope you remember themRun the same script; every step is written down
2 million rowsExcel stops at 1,048,576pandas handles it on a laptop
Combine 40 CSV files from a folderCopy-paste 40 timesA five-line loop
Pull data from a web page or an APIManual copyrequests + a parser
Prove how a number was producedClick through formulasRead the code top to bottom

The theme of this whole course is reproducibility: another person (or you, in three months) can run your work and get the same numbers. A script is a written-down recipe; a spreadsheet full of hand edits is a meal nobody can cook twice.

You won't throw away Excel or SQL. Analysts use all three: SQL to pull, Python to clean and analyse, Excel or Power BI to share.

Install Python (Windows)

  1. Go to python.org/downloads and download the latest Python 3.12 or 3.13 installer.
  2. Run it. On the first screen tick "Add python.exe to PATH". This one checkbox prevents most Week 1 problems.
  3. Click Install Now.
  4. Open PowerShell (Windows key → type powershell) and check:
python --version
Python 3.12.4

Any version 3.12 or higher is fine. If you see 'python' is not recognized, re-run the installer, choose Modify, tick Add Python to environment variables, then close and reopen PowerShell.

macOS/Linux: install from python.org (macOS) or your package manager, and use python3 wherever this course says python.

Install the analyst toolkit

python -m pip install notebook pandas numpy matplotlib

pip is Python's package installer. python -m pip means "run the pip that belongs to this Python" — it avoids installing into the wrong Python when you have several. In Week 7 you'll move to a separate environment per project; for now, one shared install is fine.

Install VS Code + extensions

  1. Download VS Code from code.visualstudio.com and install it.
  2. Open the Extensions panel (Ctrl+Shift+X). Install Python and Jupyter, both by Microsoft.
  3. Create a folder Documents\da-python and open it with File → Open Folder.

Avoid OneDrive-synced folders if you can — sync can lock files while Python is writing them.

Your first notebook

  1. In VS Code: File → New File → Jupyter Notebook. Save it as week1/hello.ipynb.
  2. Top right, Select Kernel → choose your Python 3.12+.
  3. In the first cell type and run (Shift+Enter):
quantity = 2
unit_price = 10
revenue = quantity * unit_price
revenue
20

That is order 101 from the practice dataset you met in Module 1: 2 books at 10 each. The last expression in a cell is displayed automatically — you didn't need print.

Self-check

  • What does ticking "Add python.exe to PATH" do, and what error do you get without it?
  • Name one task that is easier to reproduce in Python than in a spreadsheet, and say why.

Sign in to track your progress.