Repository navigation
Conversation
This was referenced Nov 23, 2026
bashtage
force-pushed
the
wip-news-get-impacts-stack
branch
from
November 25, 2026 12:13
c8a14d3 to
33c1461
Compare
Member
Author
|
Merge order. These open PRs build on this one (their branches contain its commits), so please merge this PR first: 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 (updated 2026-11-25). |
bashtage
force-pushed
the
wip-news-get-impacts-stack
branch
2 times, most recently
from
November 27, 2026 00:31
3eaf464 to
7b88cbe
Compare
get_impacts(groupby=...) sums the impacts of the groups of updated
variables for each update date and stacks the update dates back into the
rows with .stack("update date"). On pandas 2.1 to 2.3 this raised two
FutureWarnings (the previous implementation of stack, and Index.insert
with object dtype). The previous implementation drops the rows that are
all NaN, which pandas 3 keeps, so on pandas 3 a group without impacts on
an update date had a row of NaN: for example, with a revision of unemp in
2009Q2 and new data for realgdp in 2009Q3 only, grouping each variable on
its own gave four rows instead of two.
Changes
- The update dates are stacked with FUTURE_STACK, as elsewhere in the
module, and the all-NaN rows are dropped explicitly, so the rows are
those of pandas < 3 on every version.
Results change on pandas 3 for groups without impacts on an update date:
their rows of NaN are gone. On pandas 2.1 to 2.3, a grouped table without
impacts (for example the impacts of news when there were only revisions)
is empty instead of raising "ValueError: Must pass non-zero number of
levels/codes". pandas < 2.1 is unchanged (FUTURE_STACK is empty there, and
the old stack already drops the all-NaN rows).
Not changed
- get_impacts without a groupby, and every other row and value: checked
against pandas 2.3.3 with the base for grouped tables of revisions and
news, with a function, a dict and a level as groupby, with a date and an
integer index.
Tests
- With a revision of one variable and new data for the other, for each
combination of include_revisions and include_updates, the grouped rows
are the update dates and groups with impacts, with the impacts of the
single variable of each group. The case with both fails on the base on
pandas 3, and every case warns on pandas 2.3.
- test_get_impacts_groupby no longer ignores the FutureWarnings.
…ndas < 2 With include_revisions=False and include_updates=False the impacts table is empty, and with groupby, get_impacts raised "ValueError: Must pass non-zero number of levels/codes" on pandas 1.5.3 (stack of the empty table; the Azure minimum-versions job, build 10641, test_get_impacts_groupby_rows[False-False]). An empty table has nothing to group, so it is returned as it is: the same empty table, with the index levels "update date" and "updated variable", that pandas 2 and later give.
bashtage
force-pushed
the
wip-news-get-impacts-stack
branch
from
November 28, 2026 21:36
7b88cbe to
d21db4c
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.
#11078, which this PR was stacked on, is merged. It removes the two
filterwarningsmarks that #11078 put ontest_get_impacts_groupby. The other C11 follow-up PRs (the NewsResults table fixes and the get_impacts fix) also append totest_news.py: keep both appended blocks. No conflict with #11054, #11057, #11058 or #11029.BUG: Give NewsResults.get_impacts the same rows on every pandas version
get_impacts(groupby=...) sums the impacts of the groups of updated
variables for each update date and stacks the update dates back into the
rows with .stack("update date"). On pandas 2.1 to 2.3 this raised two
FutureWarnings (the previous implementation of stack, and Index.insert
with object dtype). The previous implementation drops the rows that are
all NaN, which pandas 3 keeps, so on pandas 3 a group without impacts on
an update date had a row of NaN: for example, with a revision of unemp in
2009Q2 and new data for realgdp in 2009Q3 only, grouping each variable on
its own gave four rows instead of two.
Changes
module, and the all-NaN rows are dropped explicitly, so the rows are
those of pandas < 3 on every version.
Results change on pandas 3 for groups without impacts on an update date:
their rows of NaN are gone. On pandas 2.1 to 2.3, a grouped table without
impacts (for example the impacts of news when there were only revisions)
is empty instead of raising "ValueError: Must pass non-zero number of
levels/codes". pandas < 2.1 is unchanged (FUTURE_STACK is empty there, and
the old stack already drops the all-NaN rows).
Not changed
against pandas 2.3.3 with the base for grouped tables of revisions and
news, with a function, a dict and a level as groupby, with a date and an
integer index.
Tests
With a revision of one variable and new data for the other, for each
combination of include_revisions and include_updates, the grouped rows
are the update dates and groups with impacts, with the impacts of the
single variable of each group. The case with both fails on the base on
pandas 3, and every case warns on pandas 2.3.
test_get_impacts_groupby no longer ignores the FutureWarnings.
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