BUG: PeriodIndex.to_timestamp with explicit freq ignores how="start"#65017
Draft
jbrockmendel wants to merge 2 commits intopandas-dev:mainfrom
Draft
BUG: PeriodIndex.to_timestamp with explicit freq ignores how="start"#65017jbrockmendel wants to merge 2 commits intopandas-dev:mainfrom
jbrockmendel wants to merge 2 commits intopandas-dev:mainfrom
Conversation
…andas-dev#59371) When an explicit freq coarser than daily was passed to to_timestamp, the result always produced end-of-period timestamps due to a hardcoded is_end=True in get_unix_date. Fix by converting to daily base first, matching the existing freq=None codepath. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update expected values in doctests and tests that relied on the old (buggy) behavior where to_timestamp with an explicit freq coarser than daily always produced end-of-period timestamps. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
freqcoarser than daily (e.g.'M','Q','Y') was passed toPeriodIndex.to_timestamporPeriod.to_timestamp, the result always produced end-of-period timestamps, ignoringhow="start"(the default)get_unix_dateinperiod.pyxhardcodesis_end=Truefor the sub-daily frequency conversion pathasfreqbefore passing toperiodarr_to_dt64arr/period_ordinal_to_dt64, matching the existingfreq=NonecodepathBefore:
After:
Test plan
🤖 Generated with Claude Code