BUG: Series.sum on overflowing timedelta64 raises OutOfBoundsTimedelta (GH-43178)#65926
Merged
Merged
Conversation
pandas-devGH-43178) Series.sum on a timedelta64 reduction that overflowed int64 raised a plain ValueError. Raise OutOfBoundsTimedelta (a ValueError subclass) instead, matching the rest of pandas' overflow-on-timedelta behavior. Split out of pandas-devGH-65515, which also tightens timedelta64 multiplication overflow handling. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sharl0tteIsTaken
added a commit
to Sharl0tteIsTaken/pandas
that referenced
this pull request
Jun 25, 2026
…-comparison * upstream/main: (101 commits) TST: add regression test for non-nano datetime to_json with epoch date format (pandas-dev#65960) TST: equivalent plot frequencies render identical tick labels (GH#57587) (pandas-dev#65961) TST: x-axis labels for irregular sub-ms TimedeltaIndex plot (GH#18910) (pandas-dev#65991) TST: to_csv does not require escapechar for null byte (GH#47871) (pandas-dev#65995) TST: cut Series with NaN and integer bins (GH#55684) (pandas-dev#65998) TST: replace does not coerce np.nan to NaT (GH#48034) (pandas-dev#65999) TST: pd.NA preserved through Series.map for nullable/Arrow dtypes (GH#57390) (pandas-dev#66002) TST: read_json from binary/S3 stream with chunksize (GH#47659) (pandas-dev#66005) TST: .loc on MultiIndex with inf-bounded IntervalIndex level (GH#46699) (pandas-dev#66006) TST: read_json preserves precision of big-int string columns (GH#44684) (pandas-dev#66008) BUG: fix DataFrame.any/all(skipna=False) raising on nullable dtypes (pandas-dev#65711) BUG: Series.sum on overflowing timedelta64 raises OutOfBoundsTimedelta (pandas-devGH-43178) (pandas-dev#65926) BUG: TextReader() with no arguments segfaults (pandas-devGH-53131) (pandas-dev#65939) DOC: Add note about SQL Server temp table datetime precision loss (pandas-dev#62995) (pandas-dev#63623) DOC: correct diff result-dtype description (GH#57565) (pandas-dev#65947) TST: to_csv date_format honored for PeriodArray column (pandas-devGH-51621) (pandas-dev#65952) TST: groupby with datetime-parseable Series name (GH#51818) (pandas-dev#65953) TST: query/eval with a column named 'datetime' (pandas-devGH-35695) (pandas-dev#65967) TST: bar plot color maps per column for single-column frame (GH#18006) (pandas-dev#65971) TST: non-monotonic DatetimeIndex.get_loc raises KeyError for missing label (pandas-devGH-7827) (pandas-dev#65958) ...
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.
Reference GH-43178.
Split out of GH-65515. This is the standalone, pure-Python half of that PR; GH-65515 retains the
closes #43178line since it also fixes the multiplication overflow.Summary
Series.sumon atimedelta64reduction that overflows int64 raised a plainValueError. It now raises :class:OutOfBoundsTimedelta(aValueErrorsubclass), matching the rest of pandas' overflow-on-timedelta behavior. Because the new exception is aValueErrorsubclass, existing code that caughtValueErroris unaffected.Test plan
test_td64_summation_overflowto expectOutOfBoundsTimedeltapandas/tests/series/test_reductions.py,pandas/tests/test_nanops.py,pandas/tests/reductions/pass locally🤖 Generated with Claude Code