Skip to content

BUG: Allow selections in NewsResults details tables without rows - #11158

Draft
bashtage wants to merge 2 commits into
statsmodels:mainfrom
bashtage:wip-news-summary-empty-details
Draft

bashtage wants to merge 2 commits into
statsmodels:mainfrom
bashtage:wip-news-summary-empty-details

Conversation

@bashtage

@bashtage bashtage commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

#11118, which this PR was stacked on, is merged. It changes the selection lines that #11118 adds. No conflict in news.py with the other open news PRs; test_news.py conflicts with #11081, #11119, #11131 and #11132 only where both append tests at the end: keep both blocks.

BUG: Allow selections in NewsResults details tables without rows

When the news has no updates (for example comparison_type="updated" with
the same observations and a revision) or no revisions, its details table
has no rows at all. Selecting from it, as summary_details(impact_date=...,
impacted_variable=..., update_date=... or updated_variable=...) and
summary(impact_date=...) do, raised a KeyError, because the label is not in
the index of the empty table. #11118 lets a label whose impacts are all
within the tolerance select no rows; this is the case of a table without
any rows.

Stacked on #11118 (selections of dates and variables whose impacts are all
within the tolerance), which changes the same functions.

Changes

  • The details tables of the news and of the revisions select the rows of
    the key only if they have rows, as they already did for the impacted
    variable of the results.

Not changed

  • A label that is not in a details table with rows still raises a
    KeyError.

Tests (test_news.py)

  • Without news (an "updated" comparison without new observations) and
    without revisions (an AR(1) with one new observation), each selection
    gives the details table with only its header, the same as without a
    selection.

  • summary(impact_date=...) without news has the impacts table of that
    date, the revisions table and the details of the revisions; the impacts
    of the revision of 2009Q3 from 0 are its observed value and half of it
    (phi = 0.5) for the forecast of 2009Q4.

  • All nine fail on BUG: Allow NewsResults summaries of dates without impacts above the tolerance #11118.

  • 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.

  • No AI tools were used to develop this pull request.
  • AI tools were used.
    Tool(s): Claude Code (Claude Opus 5.5).
    Used for: finding the bug in a coverage audit of the state space code, writing the fix and its tests, and checking them (tests failing on the base, 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

When the news has no updates (for example comparison_type="updated" with
the same observations and a revision) or no revisions, its details table
has no rows at all. Selecting from it, as summary_details(impact_date=...,
impacted_variable=..., update_date=... or updated_variable=...) and
summary(impact_date=...) do, raised a KeyError, because the label is not in
the index of the empty table. statsmodels#11118 lets a label whose impacts are all
within the tolerance select no rows; this is the case of a table without
any rows.

Stacked on statsmodels#11118 (selections of dates and variables whose impacts are all
within the tolerance), which changes the same functions.

Changes
- The details tables of the news and of the revisions select the rows of
  the key only if they have rows, as they already did for the impacted
  variable of the results.

Not changed
- A label that is not in a details table with rows still raises a
  KeyError.

Tests (test_news.py)
- Without news (an "updated" comparison without new observations) and
  without revisions (an AR(1) with one new observation), each selection
  gives the details table with only its header, the same as without a
  selection.
- summary(impact_date=...) without news has the impacts table of that
  date, the revisions table and the details of the revisions; the impacts
  of the revision of 2009Q3 from 0 are its observed value and half of it
  (phi = 0.5) for the forecast of 2009Q4.
- All nine fail on statsmodels#11118.
@bashtage
bashtage force-pushed the wip-news-summary-empty-details branch from 264bebd to 7ef80fd Compare November 28, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant