Skip to content

Add vendored data + maintenance scripts for hansen_singleton lectures#926

Open
mmcky wants to merge 3 commits into
mainfrom
add-hansen-data
Open

Add vendored data + maintenance scripts for hansen_singleton lectures#926
mmcky wants to merge 3 commits into
mainfrom
add-hansen-data

Conversation

@mmcky

@mmcky mmcky commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

What

Adds vendored input data plus a maintenance script and README for the two Hansen–Singleton lectures, under the existing _static/lecture_specific/<lecture>/ convention:

  • hansen_singleton_1982/make_data.py, hansen_singleton_1982_data.csv, README.md
  • hansen_singleton_1983/make_data.py, hansen_singleton_1983_data.csv, README.md

Each make_data.py downloads the raw inputs (FRED series CNP16OV, DNDGRA3M086SBEA, DNDGRG3M086SBEA; the Ken French F-F_Research_Data_Factors monthly file), builds the analysis-ready monthly series, and writes the CSV next to it. The committed CSVs are the script output: 239 monthly observations, 1959-02 to 1978-12. The scripts use only the standard library plus pandas.

Why

This seeds the data on main so the Hansen–Singleton lectures can read it from a stable GitHub URL instead of querying FRED / Ken French live during the build — the same pattern already used by mle, ols, and pandas_panel. Benefits:

  • Reproducible builds — the data is a frozen snapshot, not whatever the providers return on build day (FRED revises history; Ken French updates).
  • No live-fetch fragility — removes a flaky-network failure class (e.g. the transient HTTP 500 seen on the ols data download).
  • Documented provenance — each README records the sources, sample, column definitions, and how to refresh (python make_data.py).

Notes

Adds _static/lecture_specific/hansen_singleton_198{2,3}/, each containing:

- make_data.py     downloads the raw FRED + Ken French inputs and builds the
                   analysis-ready monthly CSV (standard library + pandas only)
- *_data.csv       frozen snapshot, monthly 1959-02..1978-12
- README.md        sources, sample, column definitions, refresh instructions

This seeds the data on main so the lectures can read it from GitHub instead of
querying FRED / Ken French live at build time, which keeps the build
reproducible and avoids the flaky-network failure class. The lecture changes
that consume these files are in PR #925 (part of the pandas 3.0 work, #924).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 21, 2026 10:03
@mmcky mmcky added the dependencies Pull requests that update a dependency file label Jun 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds vendored, analysis-ready input datasets and regeneration scripts for the hansen_singleton_1982 and hansen_singleton_1983 lectures under the existing lectures/_static/lecture_specific/<lecture>/ pattern, to avoid live FRED / Ken French downloads during book builds.

Changes:

  • Add make_data.py scripts that download/construct the monthly series and write a committed CSV snapshot.
  • Add committed CSV snapshots for both lectures (239 monthly observations, 1959-02 to 1978-12).
  • Add per-lecture README files documenting sources, sample, columns, and refresh steps.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lectures/_static/lecture_specific/hansen_singleton_1982/README.md Documents the vendored dataset and regeneration procedure for the 1982 lecture.
lectures/_static/lecture_specific/hansen_singleton_1982/make_data.py Script to download source series and build the 1982 analysis-ready CSV.
lectures/_static/lecture_specific/hansen_singleton_1982/hansen_singleton_1982_data.csv Frozen CSV snapshot used by the lecture build.
lectures/_static/lecture_specific/hansen_singleton_1983/README.md Documents the vendored dataset and regeneration procedure for the 1983 lecture.
lectures/_static/lecture_specific/hansen_singleton_1983/make_data.py Script to download source series and build the 1983 analysis-ready CSV.
lectures/_static/lecture_specific/hansen_singleton_1983/hansen_singleton_1983_data.csv Frozen CSV snapshot used by the lecture build.

Comment thread lectures/_static/lecture_specific/hansen_singleton_1983/README.md Outdated
Comment thread lectures/_static/lecture_specific/hansen_singleton_1982/README.md Outdated
mmcky added a commit that referenced this pull request Jun 21, 2026
…line

Switch both lectures to read the pre-built monthly CSV from
_static/lecture_specific/hansen_singleton_198{2,3}/ (added in PR #926) via its
raw GitHub URL, replacing the inline FRED / Fama-French download helpers from
the previous commit. The data construction now lives in the per-lecture
make_data.py maintenance scripts; the lectures just read the frozen snapshot.

This keeps the build reproducible and off the live data endpoints, and still
removes the pandas-datareader dependency that breaks under pandas 3.0.

Depends on PR #926 (must land on main first so the raw URL resolves).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…n_cons

The README column formulas divided by `gross_inflation`, but the script
computes (and the 1983 CSV exposes) `gross_inflation_cons`. Rename to match,
and add a one-line note in the 1982 README since it is an intermediate there,
not a CSV column. Addresses Copilot review on PR #926.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown

📖 Netlify Preview Ready!

Preview URL: https://pr-926--sunny-cactus-210e3e.netlify.app

Commit: d834b09


Build Info

Wrap zipfile.ZipFile(...) in a `with` block so the archive is explicitly
closed, instead of leaving it to garbage collection. Pure refactor: both
scripts still reproduce byte-identical CSVs. Addresses Copilot review (raised
on PR #925, where this code previously lived).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants