Skip to content

Commit 64feddd

Browse files
committed
Undo Revert "remove dead code in arrays/interval.py"
This reverts commit 84b119f.
1 parent 5232375 commit 64feddd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pandas/core/arrays/interval.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,8 +1664,12 @@ def _from_combined(self, combined: np.ndarray) -> IntervalArray:
16641664
nc = combined.view("i8").reshape(-1, 2)
16651665

16661666
dtype = self._left.dtype
1667-
new_left = nc[:, 0].view(dtype)
1668-
new_right = nc[:, 1].view(dtype)
1667+
if needs_i8_conversion(dtype):
1668+
new_left = type(self._left)._from_sequence(nc[:, 0], dtype=dtype)
1669+
new_right = type(self._right)._from_sequence(nc[:, 1], dtype=dtype)
1670+
else:
1671+
new_left = nc[:, 0].view(dtype)
1672+
new_right = nc[:, 1].view(dtype)
16691673
return self._shallow_copy(left=new_left, right=new_right)
16701674

16711675
def unique(self) -> IntervalArray:

0 commit comments

Comments
 (0)