@@ -251,9 +251,11 @@ cdef class _Timestamp(datetime):
251
251
# delta --> offsets.Tick
252
252
# logic copied from delta_to_nanoseconds to prevent circular import
253
253
if hasattr (other, ' nanos' ):
254
+ # Tick
254
255
nanos = other.nanos
255
256
elif hasattr (other, ' delta' ):
256
- nanos = other.delta
257
+ # pd.Timedelta
258
+ nanos = other.value
257
259
elif PyDelta_Check(other):
258
260
nanos = (other.days * 24 * 60 * 60 * 1000000 +
259
261
other.seconds * 1000000 +
@@ -273,15 +275,7 @@ cdef class _Timestamp(datetime):
273
275
dtype = object ,
274
276
)
275
277
276
- # index/series like
277
- elif hasattr (other, ' _typ' ):
278
- return NotImplemented
279
-
280
- result = datetime.__add__ (self , other)
281
- if PyDateTime_Check(result):
282
- result = type (self )(result)
283
- result.nanosecond = self .nanosecond
284
- return result
278
+ return NotImplemented
285
279
286
280
def __sub__ (self , other ):
287
281
@@ -301,9 +295,6 @@ cdef class _Timestamp(datetime):
301
295
[self - other[n] for n in range (len (other))],
302
296
dtype = object ,
303
297
)
304
-
305
- typ = getattr (other, ' _typ' , None )
306
- if typ is not None :
307
298
return NotImplemented
308
299
309
300
if other is NaT:
@@ -339,6 +330,8 @@ cdef class _Timestamp(datetime):
339
330
" to datetime.datetime with 'Timestamp.to_pydatetime()' "
340
331
" before subtracting."
341
332
) from err
333
+ # We get here in stata tests, fall back to stdlib datetime
334
+ # method and return stdlib timedelta object
342
335
pass
343
336
elif is_datetime64_object(self ):
344
337
# GH#28286 cython semantics for __rsub__, `other` is actually
0 commit comments