Skip to content

Commit c75bec0

Browse files
committed
BUG: Raise TypeError for mismatched signed/unsigned dtypes
1 parent 5b67c6e commit c75bec0

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

pandas/core/arrays/interval.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -539,13 +539,9 @@ def from_arrays(
539539
# Check for mismatched signed/unsigned integer dtypes
540540
left_dtype = left.dtype
541541
right_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-
):
542+
if left_dtype != right_dtype:
547543
raise TypeError(
548-
f"Left and right arrays must have matching signedness. "
544+
f"Left and right arrays must have matching dtypes. "
549545
f"Got {left_dtype} and {right_dtype}."
550546
)
551547

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 signedness"):
889+
with pytest.raises(TypeError, match="matching dtypes"):
890890
IntervalIndex.from_arrays(left, right)
891891

892892

0 commit comments

Comments
 (0)