Skip to content

DEPR: Remove int64 uint64 float64 index part 1 #49560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Prev Previous commit
Next Next commit
fix interval
  • Loading branch information
topper-123 committed Jan 11, 2023
commit ea2207490d204ae33c1140803d05404daab30dab
8 changes: 7 additions & 1 deletion pandas/core/arrays/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@
from pandas.errors import IntCastingNaNError
from pandas.util._decorators import Appender

from pandas.core.dtypes.cast import LossySetitemError
from pandas.core.dtypes.cast import (
LossySetitemError,
maybe_upcast_numeric_to_64bit,
)
from pandas.core.dtypes.common import (
is_categorical_dtype,
is_dtype_equal,
Expand Down Expand Up @@ -304,7 +307,10 @@ def _ensure_simple_new_inputs(
from pandas.core.indexes.base import ensure_index

left = ensure_index(left, copy=copy)
left = maybe_upcast_numeric_to_64bit(left)

right = ensure_index(right, copy=copy)
right = maybe_upcast_numeric_to_64bit(right)

if closed is None and isinstance(dtype, IntervalDtype):
closed = dtype.closed
Expand Down
4 changes: 3 additions & 1 deletion pandas/tests/indexes/interval/test_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,9 @@ def test_maybe_convert_i8_numeric(self, make_key, any_real_numpy_dtype):
key = make_key(breaks)

result = index._maybe_convert_i8(key)
expected = Index(key)
kind = breaks.dtype.kind
expected_dtype = {"i": np.int64, "u": np.uint64, "f": np.float64}[kind]
expected = Index(key, dtype=expected_dtype)
tm.assert_index_equal(result, expected)

@pytest.mark.parametrize(
Expand Down