We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fbff58f commit eb2ff31Copy full SHA for eb2ff31
pandas/_libs/tslibs/timestamps.pyx
@@ -324,7 +324,7 @@ cdef class _Timestamp(ABCTimestamp):
324
elif other is NaT:
325
return op == Py_NE
326
elif is_datetime64_object(other):
327
- ots = _Timestamp._from_dt64(other)
+ ots = Timestamp(other)
328
elif PyDateTime_Check(other):
329
if self.nanosecond == 0:
330
val = self.to_pydatetime()
pandas/tests/scalar/timestamp/test_comparisons.py
@@ -12,6 +12,13 @@
12
13
14
class TestTimestampComparison:
15
+ def test_compare_non_nano_dt64(self):
16
+ # don't raise when converting dt64 to Timestamp in __richcmp__
17
+ dt = np.datetime64("1066-10-14")
18
+ ts = Timestamp(dt)
19
+
20
+ assert dt == ts
21
22
def test_comparison_dt64_ndarray(self):
23
ts = Timestamp("2021-01-01")
24
ts2 = Timestamp("2019-04-05")
0 commit comments