Skip to content

Commit

Permalink
fix interval
Browse files Browse the repository at this point in the history
  • Loading branch information
topper-123 committed Jan 11, 2023
1 parent d48f7bb commit ea22074
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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

0 comments on commit ea22074

Please sign in to comment.