Week 1 — Environment & Language Basics · ~50 min
Why analysts learn Python & setting up
Free previewWhat you'll learn this week
- Install Python 3.12+, VS Code and Jupyter, and prove they work
- Run code two ways — notebook cells and a
.pyscript — and explain execution order - Use variables and the core types:
int,float,str,bool,None - Convert between types and explain why
"2"is not2 - Format output with f-strings: thousands separators, decimals, percentages
- Read an error message bottom-up and trace a program's state
- 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:
| Problem | Spreadsheet | Python |
|---|---|---|
| Repeat last month's cleaning on this month's file | Redo the clicks, hope you remember them | Run the same script; every step is written down |
| 2 million rows | Excel stops at 1,048,576 | pandas handles it on a laptop |
| Combine 40 CSV files from a folder | Copy-paste 40 times | A five-line loop |
| Pull data from a web page or an API | Manual copy | requests + a parser |
| Prove how a number was produced | Click through formulas | Read 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)
- Go to python.org/downloads and download the latest Python 3.12 or 3.13 installer.
- Run it. On the first screen tick "Add python.exe to PATH". This one checkbox prevents most Week 1 problems.
- Click Install Now.
- 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
- Download VS Code from code.visualstudio.com and install it.
- Open the Extensions panel (Ctrl+Shift+X). Install Python and Jupyter, both by Microsoft.
- Create a folder
Documents\da-pythonand 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
- In VS Code: File → New File → Jupyter Notebook. Save it as
week1/hello.ipynb. - Top right, Select Kernel → choose your Python 3.12+.
- 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.