Skip to content

TST: groupby with multi-day Grouper and closed="right" on intraday data (GH#43896)#66030

Merged
jbrockmendel merged 1 commit into
pandas-dev:mainfrom
jbrockmendel:bug-43896
Jun 26, 2026
Merged

TST: groupby with multi-day Grouper and closed="right" on intraday data (GH#43896)#66030
jbrockmendel merged 1 commit into
pandas-dev:mainfrom
jbrockmendel:bug-43896

Conversation

@jbrockmendel

Copy link
Copy Markdown
Member

closes #43896

Adds a regression test for df.groupby(Grouper(freq="2D", closed="right")) on intraday data, which used to raise ValueError: Values falls before first bin from generate_bins_dt64.

The underlying bug was fixed by GH-55283 (released in 2.1.2), which replaced the is_superperiod(self.freq, "D") heuristic in _adjust_bin_edges with an explicit allowlist of super-daily rule codes. That heuristic only inspected the base frequency, so it misfired on multi-day freqs like 2D, rolling the first bin edge forward to the last nanosecond of the day (ahead of the first intraday value). No regression test referenced this issue.

…ta (GH#43896)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jbrockmendel jbrockmendel added Testing pandas testing functions or related to the test suite Groupby Frequency DateOffsets Resample resample method labels Jun 26, 2026
@jbrockmendel jbrockmendel marked this pull request as ready for review June 26, 2026 16:28
@jbrockmendel jbrockmendel merged commit 464bcfb into pandas-dev:main Jun 26, 2026
56 of 58 checks passed
@jbrockmendel jbrockmendel deleted the bug-43896 branch June 26, 2026 16:29
hamdanal pushed a commit to hamdanal/pandas that referenced this pull request Jun 27, 2026
…ta (GH#43896) (pandas-dev#66030)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frequency DateOffsets Groupby Resample resample method Testing pandas testing functions or related to the test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: bug in DataFrame.groupby(Grouper) triggers a ValueError exception in cython generate_bins_dt64() code

1 participant