File tree 1 file changed +8
-2
lines changed 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 59
59
REPR_ELLIPSIS_SHOW_ITEMS_FRONT_END = 10
60
60
61
61
62
+ if LooseVersion (pd .__version__ ) > LooseVersion ("1.2.3" ):
63
+ OUT_OF_BOUNDS_TIMEDELTA_ERROR = pd .errors .OutOfBoundsTimedelta
64
+ else :
65
+ OUT_OF_BOUNDS_TIMEDELTA_ERROR = OverflowError
66
+
67
+
62
68
def named (name , pattern ):
63
69
return "(?P<" + name + ">" + pattern + ")"
64
70
@@ -562,7 +568,7 @@ def __sub__(self, other):
562
568
elif _contains_cftime_datetimes (np .array (other )):
563
569
try :
564
570
return pd .TimedeltaIndex (np .array (self ) - np .array (other ))
565
- except OverflowError :
571
+ except OUT_OF_BOUNDS_TIMEDELTA_ERROR :
566
572
raise ValueError (
567
573
"The time difference exceeds the range of values "
568
574
"that can be expressed at the nanosecond resolution."
@@ -573,7 +579,7 @@ def __sub__(self, other):
573
579
def __rsub__ (self , other ):
574
580
try :
575
581
return pd .TimedeltaIndex (other - np .array (self ))
576
- except OverflowError :
582
+ except OUT_OF_BOUNDS_TIMEDELTA_ERROR :
577
583
raise ValueError (
578
584
"The time difference exceeds the range of values "
579
585
"that can be expressed at the nanosecond resolution."
You can’t perform that action at this time.
0 commit comments