File tree Expand file tree Collapse file tree 3 files changed +5
-2
lines changed Expand file tree Collapse file tree 3 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ Backwards incompatible API changes
4040Other API Changes
4141^^^^^^^^^^^^^^^^^
4242
43+ - ``NaT`` division with :class:`datetime.timedelta` will now return ``NaN`` instead of raising (:issue:`17876`)
4344- :class:`Timestamp` will no longer silently ignore unused or invalid `tz` or `tzinfo` arguments (:issue:`17690`)
4445-
4546-
Original file line number Diff line number Diff line change @@ -1448,15 +1448,15 @@ _nat_scalar_rules[Py_GE] = False
14481448
14491449
14501450cdef _nat_divide_op(self , other):
1451- if (isinstance (other, Timedelta ) or
1451+ if (PyDelta_Check (other) or
14521452 is_timedelta64_object(other) or other is NaT):
14531453 return np.nan
14541454 if is_integer_object(other) or is_float_object(other):
14551455 return NaT
14561456 return NotImplemented
14571457
14581458cdef _nat_rdivide_op(self , other):
1459- if isinstance (other, Timedelta ):
1459+ if PyDelta_Check (other):
14601460 return np.nan
14611461 return NotImplemented
14621462
Original file line number Diff line number Diff line change @@ -248,6 +248,8 @@ def test_nat_arithmetic():
248248 assert left + right is NaT
249249 assert right - left is NaT
250250 assert left - right is NaT
251+ assert np .isnan (left / right )
252+ assert np .isnan (right / left )
251253
252254 # GH 11718
253255 t_utc = Timestamp ('2014-01-01' , tz = 'UTC' )
You can’t perform that action at this time.
0 commit comments