Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions pandas/core/arrays/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -2128,9 +2128,8 @@ def _combined(self) -> IntervalSide:
)
comb = comb.view("complex128")[:, 0]
else:
comb = (np.array(left.ravel(), dtype="complex128")) + (
1j * np.array(right.ravel(), dtype="complex128")
)
comb = np.asarray(left.ravel(), dtype="complex128")
comb.imag = right.ravel()
return comb

def _from_combined(self, combined: np.ndarray) -> IntervalArray:
Expand Down
14 changes: 14 additions & 0 deletions pandas/tests/arrays/interval/test_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,20 @@ def test_unique_with_negatives(self):
)
tm.assert_index_equal(result, expected)

@pytest.mark.parametrize(
"data",
[
[Interval(-np.inf, 0), Interval(-np.inf, 1)],
[Interval(0, np.inf), Interval(1, np.inf)],
],
)
def test_unique_with_infinty(self, data):
# https://github.com/pandas-dev/pandas/issues/63218
s = pd.Series(data)
tm.assert_interval_array_equal(s.unique(), s.array)
assert s.nunique() == 2
tm.assert_series_equal(s.drop_duplicates(), s)


class TestSetitem:
def test_set_na(self, left_right_dtypes):
Expand Down
Loading