数据集Datasets
Every dataset Semester 1 uses, with its source, size, license, and how to load it. All checked on 20 November 2026.
Every lab loads its data with one line of code. Nothing needs an account or a manual download. Each link and loader on this page was checked on 20 November 2026.
Lab datasets
| Week | Dataset | Rows | License | Source |
|---|---|---|---|---|
| 2, 3 | Palmer penguins | 344 | CC0 | Horst, Hill, and Gorman |
| 4 | Mushroom | 8,124 | CC BY 4.0 | UCI |
| 5 | Air Quality | 9,357 | CC BY 4.0 | UCI, De Vito |
| 6 | Online Retail | 541,909 | CC BY 4.0 | UCI, Chen |
| 7, 9 | California housing | 20,640 | Not stated. 1990 US Census data | StatLib, via scikit-learn |
| 8, 12 | Bank Marketing | 45,211 | CC BY 4.0 | UCI, Moro, Rita, and Cortez |
| 10 | Statlog German Credit | 1,000 | CC BY 4.0 | UCI, Hofmann |
| 11 | Bike Sharing | 17,379 | CC BY 4.0 | UCI, Fanaee-T |
| 13 | Wine Quality | 6,497 | CC BY 4.0 | UCI, Cortez, and others |
| 14 | Dry Bean | 13,611 | CC BY 4.0 | UCI |
| 14 | Mammography | 11,183 | Public | OpenML 310 |
| 15 | Mauna Loa CO₂ | 2,284 weeks | Public domain (NOAA) | Ships with statsmodels |
CC BY 4.0 lets you share and adapt the data for any purpose, with credit. Cite the DOI when you publish work that uses one.
How each one loads
import pandas as pd
# UCI datasets: one CSV per dataset, by its UCI id
uci = lambda i: pd.read_csv(f"https://archive.ics.uci.edu/static/public/{i}/data.csv")
mushroom, air, retail = uci(73), uci(360), uci(352)
bank, credit, bikes = uci(222), uci(144), uci(275)
wine, beans = uci(186), uci(602)
penguins = pd.read_csv("https://raw.githubusercontent.com/mwaskom/seaborn-data/master/penguins.csv")
from sklearn.datasets import fetch_california_housing, fetch_openml
housing = fetch_california_housing(as_frame=True).frame
mammo = fetch_openml(data_id=310, as_frame=True)
import statsmodels.api as sm
co2 = sm.datasets.co2.load_pandas().dataOnline Retail is about 45 MB. The others are under 4 MB. scikit-learn caches what it downloads, so the second load is instant.
Known problems, on purpose
Some labs depend on a dataset's flaws. Don't clean these away before the lab asks you to.
- Air Quality codes missing readings as
-200. One column is about 90% missing. - California housing caps house value and house age at a maximum. 965 and 1,273 rows sit on the caps.
- Bank Marketing has a column that's only known after the call ends. Week 8 asks you to find it.
- Online Retail has cancellations, negative quantities, and about 25% of rows with no customer ID.
Companion notebook data
The chapter notebooks mostly use synthetic data, generated in the notebook, and datasets that ship with scikit-learn: iris, breast cancer, and digits. Two notebooks download data:
| Chapter | Data | Source | Checked |
|---|---|---|---|
| 1 | Paper counts from arXiv | arXiv API | Works |
| 6, 9 | Titanic passengers | seaborn's sample data, from GitHub | Works |
If a source breaks
Sources move. If a download fails, check this page first. A moved source gets its new address here. If it's not listed, tell your instructor.