Skip to content

Commit f1cc855

Browse files
committed
Avoid pyarrow imports
1 parent f40224f commit f1cc855

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

pandas/core/indexes/datetimes.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,10 @@ def _is_comparable_dtype(self, dtype: DtypeObj) -> bool:
389389
"""
390390
if isinstance(dtype, ArrowDtype):
391391
# GH#62277
392-
import pyarrow as pa
392+
if dtype.kind != "M":
393+
return False
393394

394395
pa_dtype = dtype.pyarrow_dtype
395-
if not pa.types.is_timestamp(pa_dtype):
396-
return False
397396
if (pa_dtype.tz is None) ^ (self.tz is None):
398397
return False
399398
return True

pandas/core/indexes/timedeltas.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,7 @@ def _is_comparable_dtype(self, dtype: DtypeObj) -> bool:
196196
Can we compare values of the given dtype to our own?
197197
"""
198198
if isinstance(dtype, ArrowDtype):
199-
import pyarrow as pa
200-
201-
return pa.types.is_duration(dtype.pyarrow_dtype)
199+
return dtype.kind == "m"
202200
return lib.is_np_dtype(dtype, "m") # aka self._data._is_recognized_dtype
203201

204202
# -------------------------------------------------------------------

0 commit comments

Comments
 (0)