Skip to content

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.

  1. Download course-data.zip. It is about 1.3 MB.

  2. Move the file into your my-course folder.

  3. Unzip it there, so that a folder called data appears directly inside my-course.

Double-click the zip file in Finder, or run this in the terminal from my-course:

Terminal
unzip course-data.zip

The 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 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.

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.

check_data.py
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")
Output
32 files
ab_test.csv 10,000 rows
customers.csv 5,000 rows
houses.csv 3,000 rows
legacy_latin1.csv 12 rows
products.csv 30 rows
reviews.csv 3,000 rows
sales.csv 20,228 rows
sales_raw.csv 1,200 rows
sensors.csv 8,064 rows
stores.csv 12 rows
web_traffic.csv 1,096 rows

What the code does, in short (the modules explain each part):

  • data.rglob("*") finds every path below data/, 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 inside data/.
  • pd.read_csv reads a CSV file into a table, and len counts its rows. The legacy file needs encoding="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.

Learn how the course is organised and how to study it: How to study.