File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -234,7 +234,7 @@ Numeric
234234Conversion
235235^^^^^^^^^^
236236- Bug in :class: `Series ` construction from NumPy array with big-endian ``datetime64 `` dtype (:issue: `29684 `)
237- -
237+ - Bug in :class: ` Timedelta ` construction with large nanoseconds keyword value ( :issue: ` 34202 `)
238238-
239239
240240Strings
Original file line number Diff line number Diff line change @@ -1198,7 +1198,7 @@ class Timedelta(_Timedelta):
11981198
11991199 kwargs = {key: _to_py_int_float(kwargs[key]) for key in kwargs}
12001200
1201- nano = np.timedelta64 (kwargs.pop(' nanoseconds' , 0 ), ' ns' )
1201+ nano = convert_to_timedelta64 (kwargs.pop(' nanoseconds' , 0 ), ' ns' )
12021202 try :
12031203 value = nano + convert_to_timedelta64(timedelta(** kwargs),
12041204 ' ns' )
Original file line number Diff line number Diff line change @@ -28,3 +28,9 @@ def test_delta_to_nanoseconds_error():
2828
2929 with pytest .raises (TypeError , match = "<class 'numpy.ndarray'>" ):
3030 delta_to_nanoseconds (obj )
31+
32+
33+ def test_huge_nanoseconds_overflow ():
34+ # GH 32402
35+ assert delta_to_nanoseconds (Timedelta (1e10 )) == 1e10
36+ assert delta_to_nanoseconds (Timedelta (nanoseconds = 1e10 )) == 1e10
You can’t perform that action at this time.
0 commit comments