Skip to content

Commit fb37281

Browse files
Fix CI: study 217 synthetic index overflowed pandas Timestamp bounds
The Lipstick-Index null tape builds 5000 monthly points with pd.date_range("2000-01-01", periods=5000, freq="MS"), which lands in 2416 — past pandas' ~2262 nanosecond-Timestamp bound — and raised OutOfBoundsDatetime on the CI runners (3.10–3.12), reddening the whole tests workflow since the 211-251 batch. It happened to pass on the newer local pandas only. The month label is decorative (recession months are drawn at random, not by date) and the docstring already calls it a period, so switch to pd.period_range — PeriodIndex has no nanosecond bound. No test reads the column as a Timestamp; the 217 suite is green.
1 parent e6414d2 commit fb37281

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • studies/217-lipstick-index/lipstick_index

studies/217-lipstick-index/lipstick_index/data.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ def synthetic_monthly(
133133
base_m = base_return_ann / 12.0
134134
vol_m = vol_ann / np.sqrt(12)
135135

136-
months = pd.date_range("2000-01-01", periods=n_months, freq="MS")
136+
# PeriodIndex (not date_range): the label is decorative, and a large n_months
137+
# (e.g. the 5000-month null tape) would push a Timestamp index past pandas'
138+
# ~2262 nanosecond bound and raise OutOfBoundsDatetime on CI. Periods have no
139+
# such bound, and the docstring already calls this column a period.
140+
months = pd.period_range("2000-01", periods=n_months, freq="M")
137141
in_rec = rng.random(n_months) < recession_fraction
138142

139143
spy_rets = rng.normal(base_m, vol_m, n_months)

0 commit comments

Comments
 (0)