Skip to content

Commit ed887d9

Browse files
committed
BUG: Raise TypeError for mismatched signed/unsigned dtypes
1 parent 439efbe commit ed887d9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ Interval
958958
^^^^^^^^
959959
- :meth:`Index.is_monotonic_decreasing`, :meth:`Index.is_monotonic_increasing`, and :meth:`Index.is_unique` could incorrectly be ``False`` for an ``Index`` created from a slice of another ``Index``. (:issue:`57911`)
960960
- Bug in :func:`interval_range` where start and end numeric types were always cast to 64 bit (:issue:`57268`)
961-
-
961+
- Construction of :class:`IntervalArray` and :class:`IntervalIndex` from arrays with mismatched signed/unsigned integer dtypes (e.g., ``int64`` and ``uint64``) now raises a :exc:`TypeError` instead of proceeding silently. (:issue:`55715`)
962962

963963
Indexing
964964
^^^^^^^^

pandas/core/arrays/interval.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,9 @@ def from_arrays(
533533
copy: bool = False,
534534
dtype: Dtype | None = None,
535535
) -> Self:
536+
left = _maybe_convert_platform_interval(left)
537+
right = _maybe_convert_platform_interval(right)
538+
536539
# Check for mismatched signed/unsigned integer dtypes
537540
left_dtype = getattr(left, "dtype", None)
538541
right_dtype = getattr(right, "dtype", None)
@@ -547,8 +550,6 @@ def from_arrays(
547550
f"Left and right arrays must have matching signedness. "
548551
f"Got {left_dtype} and {right_dtype}."
549552
)
550-
left = _maybe_convert_platform_interval(left)
551-
right = _maybe_convert_platform_interval(right)
552553

553554
left, right, dtype = cls._ensure_simple_new_inputs(
554555
left,

0 commit comments

Comments
 (0)