Revise NDFrame.resample doc to reflect changes in #61985#64089
Merged
jbrockmendel merged 1 commit intopandas-dev:mainfrom Mar 18, 2026
Merged
Revise NDFrame.resample doc to reflect changes in #61985#64089jbrockmendel merged 1 commit intopandas-dev:mainfrom
NDFrame.resample doc to reflect changes in #61985#64089jbrockmendel merged 1 commit intopandas-dev:mainfrom
Conversation
jbrockmendel
reviewed
Mar 3, 2026
|
|
||
| Only takes effect for Tick-frequencies (i.e. fixed frequencies like | ||
| days, hours, and minutes, rather than months or quarters). | ||
| hours and minutes, rather than days, months or quarters). |
Member
There was a problem hiding this comment.
are you sure this is accurate? I think we special-case Day offsets to be tick-like in some circumstances.
Contributor
Author
There was a problem hiding this comment.
I'm pretty sure the change is warranted for this specific context of NDFrame.resample. A call to this method ends up instantiating an instance of TimeGrouper (here) which in turn (since 3.0.0) raises a RuntimeWarning (here) if origin was passed although the frequency was in terms of days (i.e. non-tick).
So for
df = pd.DataFrame([1] * 5, index=pd.date_range("2026-06-02", periods=5))this:
assert pd.__version__ == '2.3.3'
df.resample("3D", origin="2026-06-01").sum()returns:
| 0 | |
|---|---|
| 2026-06-01 00:00:00 | 2 |
| 2026-06-04 00:00:00 | 3 |
whilst this:
assert pd.__version__ == '3.0.0'
df.resample("3D", origin="2026-06-01").sum()raises:
RuntimeWarning: The 'origin' keyword does not take effect when resampling with a 'freq' that is not Tick-like (h, m, s, ms, us, ns)
df.resample("3D", origin="2026-06-01").sum()
and returns:
| 0 | |
|---|---|
| 2026-06-02 00:00:00 | 3 |
| 2026-06-05 00:00:00 | 2 |
(The change came to my attention as I had a test that started failing with 3.0.0 precisely because it was assuming day as a tick frequency when resampling in this way).
Member
|
thanks @maread99 |
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.
doc/source/whatsnew/vX.X.X.rstfile if fixing a bug or adding a new feature.AGENTS.md.@jbrockmendel, I believe this fixes a small oversight in necessary doc changes for #61985.
...sorry, the PR title should have been prefixed with DOC: