Skip to content

Commit b28670f

Browse files
committed
Use kind to speed up dtype decision
1 parent f2b1e10 commit b28670f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pandas/core/indexes/base.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -591,20 +591,20 @@ def _dtype_to_subclass(cls, dtype: DtypeObj):
591591

592592
return TimedeltaIndex
593593

594-
elif is_float_dtype(dtype):
594+
elif dtype.kind == "f":
595595
from pandas.core.api import Float64Index
596596

597597
return Float64Index
598-
elif is_unsigned_integer_dtype(dtype):
598+
elif dtype.kind == "u":
599599
from pandas.core.api import UInt64Index
600600

601601
return UInt64Index
602-
elif is_signed_integer_dtype(dtype):
602+
elif dtype.kind == "i":
603603
from pandas.core.api import Int64Index
604604

605605
return Int64Index
606606

607-
elif dtype == _dtype_obj:
607+
elif dtype.kind == "O":
608608
# NB: assuming away MultiIndex
609609
return Index
610610

0 commit comments

Comments
 (0)