Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
addressing comments
  • Loading branch information
topper-123 committed May 17, 2021
commit c1c7edd7e23c2378c94e66df262145996dcd4c2e
66 changes: 29 additions & 37 deletions pandas/core/indexes/numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,19 @@
"""


_numeric_index_descr_args = {
"klass": "NumericIndex",
"ltype": "integer or float",
"dtype": "inferred",
"extra": "",
}


class NumericIndex(Index):
"""
Provide numeric type operations.

This is an abstract class.
"""

_index_descr_args = {
"klass": "NumericIndex",
"ltype": "integer or float",
"dtype": "inferred",
"extra": "",
}
_values: np.ndarray
_default_dtype: np.dtype
_dtype_validation_metadata: tuple[Callable[..., bool], str]
Expand All @@ -109,7 +107,7 @@ def _can_hold_na(self) -> bool:
else:
return False

@property
@cache_readonly
def _engine_type(self):
return {
np.int8: libindex.Int8Engine,
Expand All @@ -124,7 +122,7 @@ def _engine_type(self):
np.float64: libindex.Float64Engine,
}[self.dtype.type]

@property
@cache_readonly
def inferred_type(self) -> str:
return {
"i": "integer",
Expand Down Expand Up @@ -357,50 +355,44 @@ def asi8(self) -> np.ndarray:
return self._values.view(self._default_dtype)


_int64_descr_args = {
"klass": "Int64Index",
"ltype": "integer",
"dtype": "int64",
"extra": "",
}


class Int64Index(IntegerIndex):
__doc__ = _num_index_shared_docs["class_descr"] % _int64_descr_args
_index_descr_args = {
"klass": "Int64Index",
"ltype": "integer",
"dtype": "int64",
"extra": "",
}
__doc__ = _num_index_shared_docs["class_descr"] % _index_descr_args

_typ = "int64index"
_engine_type = libindex.Int64Engine
_default_dtype = np.dtype(np.int64)
_dtype_validation_metadata = (is_signed_integer_dtype, "signed integer")


_uint64_descr_args = {
"klass": "UInt64Index",
"ltype": "unsigned integer",
"dtype": "uint64",
"extra": "",
}


class UInt64Index(IntegerIndex):
__doc__ = _num_index_shared_docs["class_descr"] % _uint64_descr_args
_index_descr_args = {
"klass": "UInt64Index",
"ltype": "unsigned integer",
"dtype": "uint64",
"extra": "",
}
__doc__ = _num_index_shared_docs["class_descr"] % _index_descr_args

_typ = "uint64index"
_engine_type = libindex.UInt64Engine
_default_dtype = np.dtype(np.uint64)
_dtype_validation_metadata = (is_unsigned_integer_dtype, "unsigned integer")


_float64_descr_args = {
"klass": "Float64Index",
"dtype": "float64",
"ltype": "float",
"extra": "",
}


class Float64Index(NumericIndex):
__doc__ = _num_index_shared_docs["class_descr"] % _float64_descr_args
_index_descr_args = {
"klass": "Float64Index",
"dtype": "float64",
"ltype": "float",
"extra": "",
}
__doc__ = _num_index_shared_docs["class_descr"] % _index_descr_args

_typ = "float64index"
_engine_type = libindex.Float64Engine
Expand Down