Skip to content

Commit 9b6dafc

Browse files
committed
Revert "BUG: Raise TypeError for mismatched signed/unsigned dtypes"
This reverts commit c75bec0.
1 parent c75bec0 commit 9b6dafc

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

pandas/core/arrays/interval.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,9 +539,13 @@ def from_arrays(
539539
# Check for mismatched signed/unsigned integer dtypes
540540
left_dtype = left.dtype
541541
right_dtype = right.dtype
542-
if left_dtype != right_dtype:
542+
if (
543+
left_dtype.kind in "iu"
544+
and right_dtype.kind in "iu"
545+
and left_dtype.kind != right_dtype.kind
546+
):
543547
raise TypeError(
544-
f"Left and right arrays must have matching dtypes. "
548+
f"Left and right arrays must have matching signedness. "
545549
f"Got {left_dtype} and {right_dtype}."
546550
)
547551

pandas/tests/indexes/interval/test_interval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ def test_from_arrays_mismatched_signedness_raises():
886886
# GH 55715
887887
left = np.array([0, 1, 2], dtype="int64")
888888
right = np.array([1, 2, 3], dtype="uint64")
889-
with pytest.raises(TypeError, match="matching dtypes"):
889+
with pytest.raises(TypeError, match="matching signedness"):
890890
IntervalIndex.from_arrays(left, right)
891891

892892

0 commit comments

Comments
 (0)