From dd0c4880986095497a764ec9004f5d1c17d33dfc Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Wed, 12 Aug 2026 10:28:01 +1000 Subject: [PATCH] Read life-expectancy and usa-gini from data-lectures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wave A4 of the datasets migration: the last two Track A CSVs moved to QuantEcon/data-lectures in QuantEcon/data-lectures#74, which is on `main` and serving both files. Three URLs, no other change. simple_linear_regression.md:421 {download} target simple_linear_regression.md:426 data_url inequality.md:608 data_url All three land on `raw.githubusercontent.com` — one spelling for reads and downloads alike, matching the decision taken during the high_dim_data fold. It drops a redirect hop and avoids the two-hosts-in-one-file split that the "harmonise these forms" class of fix has broken before. This lands BEFORE the English repoint deliberately. The sync PR that QuantEcon/lecture-python-intro's merge will generate then finds these lines already correct, so it is a no-op on them instead of a race — the same ordering used for the high_dim_data fold, where it worked. Left alone on purpose: simple_linear_regression.md:443 `cols = [... 'Life expectancy at birth (historical)' ...]`. The migrated bytes are byte-identical to intro's, so the old column label is still the correct one. Upstream OWID has since renamed four of eight columns and halved the row count; that delta is recorded in the manifest and registered on QuantEcon/data-lectures#39, and adopting it would be a content change, not a repoint. inequality.md:605 the `[此笔记本]` link to intro's `_static/.../data.ipynb`. It points at a notebook, not a dataset, and that notebook stays in lecture-python-intro. Verified rather than assumed: - Line numbers re-derived against `main` immediately before editing. They drift here: these three moved twice in one afternoon during the previous wave. `bin/zh-fold-lines` cannot see simple_linear_regression.md, so that file was grepped by hand. - The localisation is intact. Both changed lines are byte-identical outside the URL itself, checked programmatically — line 421 is Chinese prose wrapping the {download} role, exactly the shape a whole-cell sync replacement has clobbered before. - Line counts unchanged (587 / 1102), so nothing reflowed. - No reference to intro's copies of either file remains. - Old and new URLs produce IDENTICAL frames under the lecture's own code: both `read_csv` calls in simple_linear_regression (10x8 and 62156x4), `dropna()` at 12,445 rows (which is what the prose asserts), the `Year == 2018` filter at 166 rows that drives the fitted scatter, and inequality's 20x3 with an identical index. So this cannot change a figure. --- lectures/inequality.md | 2 +- lectures/simple_linear_regression.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lectures/inequality.md b/lectures/inequality.md index b89fc98..1f55115 100644 --- a/lectures/inequality.md +++ b/lectures/inequality.md @@ -605,7 +605,7 @@ df_income_wealth.year.describe() [此笔记本](https://github.com/QuantEcon/lecture-python-intro/tree/main/lectures/_static/lecture_specific/inequality/data.ipynb) 可以用于计算整个数据集中的此信息。 ```{code-cell} ipython3 -data_url = 'https://github.com/QuantEcon/lecture-python-intro/raw/main/lectures/_static/lecture_specific/inequality/usa-gini-nwealth-tincome-lincome.csv' +data_url = 'https://raw.githubusercontent.com/QuantEcon/data-lectures/main/lectures/usa-gini-nwealth-tincome-lincome.csv' ginis = pd.read_csv(data_url, index_col='year') ginis.head(n=5) ``` diff --git a/lectures/simple_linear_regression.md b/lectures/simple_linear_regression.md index 4469f24..dd9af46 100644 --- a/lectures/simple_linear_regression.md +++ b/lectures/simple_linear_regression.md @@ -418,12 +418,12 @@ plt.vlines(df['X'], df['Y_hat'], df['Y'], color='r'); ::: -如果你遇到困难,可以从这里下载{download}`数据副本 ` +如果你遇到困难,可以从这里下载{download}`数据副本 ` **第3问:** 使用`pandas`导入`csv`格式的数据并绘制几个感兴趣的国家的图表 ```{code-cell} ipython3 -data_url = "https://github.com/QuantEcon/lecture-python-intro/raw/main/lectures/_static/lecture_specific/simple_linear_regression/life-expectancy-vs-gdp-per-capita.csv" +data_url = "https://raw.githubusercontent.com/QuantEcon/data-lectures/main/lectures/life-expectancy-vs-gdp-per-capita.csv" df = pd.read_csv(data_url, nrows=10) ```