Skip to content

Commit ce35d54

Browse files
committed
NumericIndex._engine_type
1 parent 34519f1 commit ce35d54

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

pandas/core/indexes/numeric.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,22 @@ def _can_hold_na(self) -> bool:
106106
else:
107107
return False
108108

109+
_engine_types: dict[np.dtype : libindex.IndexEngine] = {
110+
np.dtype(np.int8): libindex.Int8Engine,
111+
np.dtype(np.int16): libindex.Int16Engine,
112+
np.dtype(np.int32): libindex.Int32Engine,
113+
np.dtype(np.int64): libindex.Int64Engine,
114+
np.dtype(np.uint8): libindex.UInt8Engine,
115+
np.dtype(np.uint16): libindex.UInt16Engine,
116+
np.dtype(np.uint32): libindex.UInt32Engine,
117+
np.dtype(np.uint64): libindex.UInt64Engine,
118+
np.dtype(np.float32): libindex.Float32Engine,
119+
np.dtype(np.float64): libindex.Float64Engine,
120+
}
121+
109122
@property
110123
def _engine_type(self):
111-
return {
112-
np.int8: libindex.Int8Engine,
113-
np.int16: libindex.Int16Engine,
114-
np.int32: libindex.Int32Engine,
115-
np.int64: libindex.Int64Engine,
116-
np.uint8: libindex.UInt8Engine,
117-
np.uint16: libindex.UInt16Engine,
118-
np.uint32: libindex.UInt32Engine,
119-
np.uint64: libindex.UInt64Engine,
120-
np.float32: libindex.Float32Engine,
121-
np.float64: libindex.Float64Engine,
122-
}[self.dtype.type]
124+
return self._engine_types[self.dtype]
123125

124126
@cache_readonly
125127
def inferred_type(self) -> str:

0 commit comments

Comments
 (0)