Get the data
The examples and exercises use a shared set of datasets. A dataset is a collection of related data, usually a table. Most course datasets are CSV files (comma-separated values): plain text tables with one row per line and commas between the columns.
The data describes a fictional retail company: its stores, products, customers, sales and reviews, plus web traffic, sensor readings and an A/B test. The data is synthetic, which means a program generated it. It looks and behaves like real business data, with real problems such as missing values and messy text. Because the same datasets return in many modules, you learn them once and then focus on the new skill.
Download and unzip
Section titled “Download and unzip”-
Download course-data.zip. It is about 1.3 MB.
-
Move the file into your
my-coursefolder. -
Unzip it there, so that a folder called
dataappears directly insidemy-course.
Double-click the zip file in Finder, or run this in the terminal from my-course:
unzip course-data.zipRun this in PowerShell from my-course:
Expand-Archive -Path course-data.zip -DestinationPath .The . means “the current folder”. If you use Extract All in File Explorer instead, Windows proposes a new folder named course-data. Delete that part of the path, so the files go straight into my-course.
Run this in the terminal from my-course:
unzip course-data.zipThe result must be my-course/data/sales.csv, not my-course/course-data/data/sales.csv. If you get the extra folder, move data up one level. You can delete the zip file afterwards.
The datasets
Section titled “The datasets”The zip holds 32 files. A row is one record, for example one sale or one customer. The last column lists every module whose code reads the file.
| File | Rows | What it is | Used in modules |
|---|---|---|---|
data/sales.csv |
20,228 | Order lines for 2023–2024: date, store, customer, product, quantity, discount, revenue | 06–15, 17, 18, 20, 21, 23–25, 27–31, 33, 37, 39, 40, 44 |
data/customers.csv |
5,000 | Subscription customers with plan, contract, usage and a churned flag |
03, 06, 07, 09, 11–15, 18–22, 24–34, 36–39, 42–44 |
data/stores.csv |
12 | One row per store: city, region, size, opening date | 07, 08, 10, 11, 15, 17, 20, 21, 23–26, 31, 39, 44 |
data/products.csv |
30 | One row per product: category, cost, price, launch date | 02, 07, 09, 14, 15, 17, 23–26, 28, 30, 31, 39 |
data/sales_raw.csv |
1,200 | A messy copy of sales lines with duplicates, mixed date formats and bad values | 02, 06, 07, 09, 11, 13–15, 17, 24, 26 |
data/sales_sample.xlsx |
500 | The first 500 sales lines as an Excel file | 24 |
data/sales_sample.parquet |
500 | The same 500 lines as a Parquet file, a fast binary table format | 24, 30, 31 |
data/houses.csv |
3,000 | House sales with size, rooms, age, location and price | 12, 17–24, 26–29, 32–35, 37, 38, 42–44 |
data/web_traffic.csv |
1,096 | Daily website visits, signups and marketing spend for 2022–2024 | 24, 25, 28, 33, 37, 40 |
data/reviews.csv |
3,000 | Product reviews with a 1–5 star rating and free text | 18, 20, 32, 41 |
data/sensors.csv |
8,064 | Temperature, humidity and vibration from 4 machine sensors, every 10 minutes | 04, 06, 08–10, 13, 15, 17, 18, 20, 21, 23, 24, 26, 28, 39, 40 |
data/ab_test.csv |
10,000 | Users in a checkout-page experiment: group, device, conversion, revenue | 09, 28, 29, 32 |
data/readings.txt |
43 lines | One temperature per line, with a few invalid lines | 03, 05–07, 10–13, 18 |
data/messy_names.txt |
20 lines | Person names with odd spacing, casing and accents | 02, 07, 20, 26 |
data/legacy_latin1.csv |
12 | Supplier list in an old text encoding (latin-1) | 02, 07 |
data/config.json |
1 object | Settings for a data pipeline | 04–09, 11, 13, 17, 20, 21 |
data/customers.json |
20 records | Nested customer records with addresses and orders | 04, 05, 07, 12, 13, 17, 24 |
data/reports/2024-01.csv … 2024-06.csv |
47–55 each | Six monthly sales extracts in one folder | 06, 07, 09–11, 13, 15, 30 |
data/logs/app.log |
500 lines | Log lines from a data pipeline and its web API | 06, 07, 09, 10 |
data/shop.db |
4 tables | A SQLite database with stores, products, customers and orders | 30 |
data/api/ |
7 files | Saved web API responses (JSON) and a saved web page (HTML) | 07, 11, 12, 15, 16 |
For every column, value range and known quirk, see the Data dictionary.
The capstone projects reuse these files. For example, Sales analysis uses the sales files and Customer churn classification uses customers.csv.
Check your data
Section titled “Check your data”Run this script from my-course after you have installed the libraries. It counts the files in data/ and the rows of each CSV file at the top level of the folder.
from pathlib import Path
import pandas as pd
data = Path("data")files = [p for p in data.rglob("*") if p.is_file() and not p.name.startswith(".")]print(len(files), "files")
for path in sorted(data.glob("*.csv")): encoding = "latin-1" if path.name == "legacy_latin1.csv" else "utf-8" rows = len(pd.read_csv(path, encoding=encoding)) print(f"{path.name:<18} {rows:>6,} rows")32 filesab_test.csv 10,000 rowscustomers.csv 5,000 rowshouses.csv 3,000 rowslegacy_latin1.csv 12 rowsproducts.csv 30 rowsreviews.csv 3,000 rowssales.csv 20,228 rowssales_raw.csv 1,200 rowssensors.csv 8,064 rowsstores.csv 12 rowsweb_traffic.csv 1,096 rowsWhat the code does, in short (the modules explain each part):
data.rglob("*")finds every path belowdata/, also in sub-folders. The check skips hidden files whose names start with a dot, such as.DS_Store, which macOS creates.data.glob("*.csv")finds the CSV files directly insidedata/.pd.read_csvreads a CSV file into a table, andlencounts its rows. The legacy file needsencoding="latin-1"; module 07 explains why.
If your counts match the Output block, your data is ready. If the script prints 0 files, the data folder is in the wrong place or the terminal is not in my-course.
Next step
Section titled “Next step”Learn how the course is organised and how to study it: How to study.