diff --git a/pandas/core/indexes/numeric.py b/pandas/core/indexes/numeric.py index 28144af36d6ea..cd75336ad7bdf 100644 --- a/pandas/core/indexes/numeric.py +++ b/pandas/core/indexes/numeric.py @@ -48,6 +48,7 @@ class NumericIndex(Index): This is an abstract class. """ + _values: np.ndarray _default_dtype: np.dtype _is_numeric_dtype = True @@ -253,9 +254,7 @@ def asi8(self) -> np.ndarray: FutureWarning, stacklevel=2, ) - # error: Incompatible return value type (got "Union[ExtensionArray, ndarray]", - # expected "ndarray") - return self._values.view(self._default_dtype) # type: ignore[return-value] + return self._values.view(self._default_dtype) class Int64Index(IntegerIndex): @@ -330,10 +329,7 @@ def astype(self, dtype, copy=True): elif is_integer_dtype(dtype) and not is_extension_array_dtype(dtype): # TODO(jreback); this can change once we have an EA Index type # GH 13149 - - # error: Argument 1 to "astype_nansafe" has incompatible type - # "Union[ExtensionArray, ndarray]"; expected "ndarray" - arr = astype_nansafe(self._values, dtype=dtype) # type: ignore[arg-type] + arr = astype_nansafe(self._values, dtype=dtype) return Int64Index(arr, name=self.name) return super().astype(dtype, copy=copy)