Skip to content

Commit 07e3114

Browse files
committed
BUG: Remove special-casing for Python date objects in DatetimeIndex
1 parent 9a78967 commit 07e3114

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

pandas/core/indexes/base.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6290,6 +6290,10 @@ def _should_compare(self, other: Index) -> bool:
62906290
# respectively.
62916291
return False
62926292

6293+
# GH#62158
6294+
if self.dtype.kind == "M" and other.inferred_type == "date":
6295+
return False
6296+
62936297
dtype = _unpack_nested_dtype(other)
62946298
return (
62956299
self._is_comparable_dtype(dtype)
@@ -6311,12 +6315,6 @@ def _is_comparable_dtype(self, dtype: DtypeObj) -> bool:
63116315

63126316
pa_dtype = dtype.pyarrow_dtype
63136317
if dtype.kind != "M":
6314-
if self.dtype.kind == "b":
6315-
return dtype.kind == "b"
6316-
if is_numeric_dtype(self.dtype):
6317-
return pa.types.is_integer(pa_dtype) or pa.types.is_floating(
6318-
pa_dtype
6319-
)
63206318
if self.dtype.kind == "m" and pa.types.is_duration(pa_dtype):
63216319
return True
63226320
return False

0 commit comments

Comments
 (0)