Skip to content

Commit 8ff37c6

Browse files
committed
BUG: Remove special-casing for Python date objects in DatetimeIndex
1 parent 2e6764c commit 8ff37c6

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pandas/core/indexes/base.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6307,15 +6307,13 @@ def _is_comparable_dtype(self, dtype: DtypeObj) -> bool:
63076307
elif isinstance(dtype, ArrowDtype):
63086308
import pyarrow as pa
63096309

6310-
if dtype.kind != "M":
6310+
if self.dtype.kind != "M" or dtype.kind != "M":
63116311
return False
63126312
pa_dtype = dtype.pyarrow_dtype
63136313
if pa.types.is_date(pa_dtype):
63146314
return False
63156315
if pa.types.is_timestamp(pa_dtype):
6316-
if (getattr(pa_dtype, "tz", None) is None) ^ (
6317-
getattr(self, "tz", None) is None
6318-
):
6316+
if (pa_dtype.tz is None) ^ (getattr(self, "tz", None) is None):
63196317
return False
63206318
return True
63216319
# TODO: this was written assuming we only get here with object-dtype,

0 commit comments

Comments
 (0)