.qmd
FilesEvery assignment in this course is a Quarto document
— a .qmd file. This page gets you set up and shows you what
you actually need to do with one.
You will never create a .qmd from scratch. You copy the
assignment and fill in the blanks.
You need three things. Budget twenty minutes the first time.
You need Python 3.10 or newer. Check what you have:
python --versionIf that fails, try python3 --version. If neither works,
install from https://www.python.org/downloads/ — and on Windows,
tick “Add Python to PATH” on the first screen of the
installer. Missing that is the single most common Windows setup
problem.
Then make an environment and install everything in one command:
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txtThe requirements.txt in this repository lists every
package the course needs. Using a virtual environment
(.venv) is worth the extra line: it keeps this course’s
packages separate from anything else on your machine, and it makes
“which Python am I actually running?” answerable.
Then point your editor at it. In VS Code:
⌘⇧P (Windows: Ctrl+Shift+P) →
Python: Select Interpreter → choose the .venv
you just made. Skipping this is the most common first-week error in this
course — you install the packages into one Python and the editor runs a
different one, and you get requires the ipykernel package
or ModuleNotFoundError on code that is perfectly
correct.
jupyter is not optional. Quarto runs your Python through
a Jupyter kernel, so rendering fails without it — even though none of
your code imports it.
macOS, before Week 5:
brew install libomp, once. Without it
import xgboost fails.
Download from https://quarto.org/docs/get-started/ and run the installer. Then confirm:
quarto --versionAny 1.4 or newer is fine.
Either of these works well. Choose one and stick with it.
The most widely used editor in the industry, and the one you are most likely to meet again after this course.
Ctrl+Shift+X (Cmd+Shift+X
on Mac)| Extension | Publisher | Why |
|---|---|---|
| Quarto | Posit | .qmd editing, the Render button, preview |
| Python | Microsoft | runs your code, picks the interpreter |
Both are free.
Posit’s editor, purpose-built for data science. Quarto support is built in — no extensions to install — and it shows your variables and plots in dedicated panes, which many people find easier when working with data.
If you have used RStudio, Positron will feel familiar immediately.
Neither is wrong, and every instruction in this course works in both.
Whichever you chose: File → Open Folder → select the repository folder. Not a single file — the whole folder. Both editors need to see the project to resolve data paths correctly.
Open any assignment in assignments/ and click
Render. A preview should appear beside your code. If it
does, you are set up.
.qmd actually isA .qmd is one file holding three things.
At the very top, between --- lines:
---
title: "Homework 1, Part 1: Exponential Smoothing"
format:
html:
toc: true
---
This controls the output. Leave it alone unless an assignment says otherwise.
Ordinary markdown. **bold**, *italic*,
# headings, - bullets. This is where you write
your answers.
Python between triple backticks with {python}:
```{python}
import pandas as pd
weekly = pd.read_csv("data/processed/m5_weekly.csv")
print(weekly.shape)
```
Output appears below the chunk when you run or render it.
Every question has two parts you fill in:
```{python}
# TODO: fit SES and report test RMSE
```
Your response: (you write here, in your own words)
The code chunk is for code. The Your response block is for your writing — and that part must be yours, not your AI assistant’s. See AI_POLICY.md.
Two different things, and the distinction matters.
Running a chunk executes that one block so you can
see its output while you work. Click the little ▶ Run
Cell that appears above a chunk, or press
Ctrl+Shift+Enter (Cmd+Shift+Enter on Mac) with
your cursor inside it.
Rendering runs the whole document top to bottom in a
fresh session and produces the .html you submit. Click
Render, or:
quarto render submissions/hw01_part1_yourname/HW01_Part1_ETS.qmdWhy the difference matters. While you work, you run chunks one at a time and variables pile up in memory. Rendering starts from nothing. A document that works chunk-by-chunk can fail completely on render — usually because something was defined in a chunk you later edited or deleted.
Always render before you submit. It is the same discipline as restarting a notebook kernel.
quarto: command not foundQuarto is not installed, or your terminal opened before you installed it. Install it, then close and reopen VS Code entirely.
No module named 'yaml'
or “Unable to start the Jupyter kernel”jupyter is not installed in the Python that Quarto is
using.
pip install jupyterIf it persists, VS Code is probably using a different Python than
your terminal. Press Ctrl+Shift+P
(Cmd+Shift+P), type Python: Select
Interpreter, and pick the one where you installed the
packages.
FileNotFoundError: data/processed/m5_weekly.csvYour working directory is wrong. Assignments read that path relative
to the repository root, so you must open the repository
as a folder in VS Code — not the .qmd on its own.
If you opened a single file, close it and use File → Open Folder instead.
.html does not show your latest workYou edited the .qmd and did not re-render. This is the
most common way to lose marks in this course, and
python scripts/check_my_submission.py checks for it
specifically — it compares the timestamps and tells you if your
.html is older than your .qmd.
Render, then check, then push.
RStudio also renders .qmd, though
Python environment setup takes more configuring than in either VS Code
or Positron. Workable if it is what you already have.
Google Colab does not support .qmd
files. It is a notebook environment with no Quarto installed
and no way to add it. You cannot complete these assignments in Colab —
please set up VS Code or Positron instead.