Skip to content

Commit ea612c4

Browse files
committed
NumericIndex._engine_type
1 parent 0d8f204 commit ea612c4

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
@@ -107,20 +107,22 @@ def _can_hold_na(self) -> bool:
107107
else:
108108
return False
109109

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

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

0 commit comments

Comments
 (0)