Repository navigation
BUG: Accept dynamic date keys that cover several dates - #10940
Merged
Merged
Conversation
bashtage
force-pushed
the
wip-tsa-dynamic-date-slice
branch
from
November 21, 2026 21:40
756d488 to
adb6ef3
Compare
4 of 5 tasks
bashtage
force-pushed
the
wip-tsa-dynamic-date-slice
branch
5 times, most recently
from
November 22, 2026 21:13
3cd4674 to
2212518
Compare
This was referenced Nov 23, 2026
Member
Author
|
Merge order. These open PRs build on this one (their branches contain its commits), so please merge this PR first: Indented PRs build on the PR above them, so merge them after it. Once this PR is merged, their diffs shrink to their own changes. Each of them also says "Stacked on #..." at the top of its description. Merge-order note generated with Claude Code. |
bashtage
force-pushed
the
wip-tsa-dynamic-date-slice
branch
2 times, most recently
from
November 23, 2026 21:45
a66c375 to
af08ce9
Compare
This was referenced Nov 24, 2026
A `dynamic` date key that matches several dates of a DatetimeIndex, such as "2001-04" for daily data, gives a slice of locations, which raised "TypeError: unsupported operand type(s) for -=: 'slice' and 'int'" in `AutoReg.predict` (and so `ARDL.predict`), `MLEResults.get_prediction` (SARIMAX, ARIMA, UnobservedComponents, ...), `STLForecastResults`, `ETSResults` and `RecursiveLSResults.get_prediction`. Dynamic prediction now begins at the first date of the key, as `MLEResults.simulate` already does for a multi-date `anchor`.
Covers the branch of the new slice check where a date string matches a single date, so that its location is used unchanged.
Since statsmodels#10975 merged, ETSModel.fit, fit_constrained and smooth warn when param_index is not given (the default changes from "integer" to "names" after statsmodels 0.17). The tests this PR adds called them without it, so they leaked that FutureWarning. Pass param_index="integer", as the existing tests do; results are unchanged.
bashtage
force-pushed
the
wip-tsa-dynamic-date-slice
branch
from
November 24, 2026 16:14
af08ce9 to
a5923bb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
dynamicdate key that matches several dates of a DatetimeIndex, such as"2001-04"for daily data, gives a slice of locations. That raised"TypeError: unsupported operand type(s) for -=: 'slice' and 'int'" in
AutoReg.predict(andARDL.predict),MLEResults.get_prediction(SARIMAX, ARIMA, UnobservedComponents, ...),
STLForecastResults.get_prediction,ETSResults.predictandget_prediction, andRecursiveLSResults.get_prediction. Once #10921 ismerged,
dynamic="2001Q2"on daily data reaches this too.Changes
MLEResults.simulatealready does for a multi-dateanchor.Not changed
True/False.VARMAXResults.simulate'sanchorhas the same problem; it is left fora separate PR.
Tests
One test per site: a key covering April 2001 equals the integer offset
of 2001-04-01 (location computed by hand and checked against
pd.date_range). All 6 fail on main. With BUG: Select the whole quarter for "YYYYQn" keys on date indexes #10921 merged,dynamic="2001Q2"on daily data equals the same offset at every site.tests added / passed.
code/documentation is well formatted.
properly formatted commit message. See
NumPy's guide.
AI Disclosure
Contributions must comply with the statsmodels AI Policy.
Tick exactly one of the following. If AI tools were used, replace the
<...>placeholders in the second option with the tool name(s) and how the tool's output was
used.
Tool(s): Claude Code (Claude Opus 5.5).
Used for: finding the bug in a contract audit, writing the fix and its tests, and checking them (tests failing on main, mutation check).
I have personally read, understood, and can explain every line of this diff, and
have verified the statistical/numerical correctness of the change.
🤖 Generated with Claude Code