Skip to content

Commit ddbc2cd

Browse files
issue pandas-dev#57268 - github actions resolution
1 parent f71d202 commit ddbc2cd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pandas/core/indexes/interval.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1120,10 +1120,13 @@ def interval_range(
11201120
# error: Argument 1 to "maybe_downcast_numeric" has incompatible type
11211121
# "Union[ndarray[Any, Any], TimedeltaIndex, DatetimeIndex]";
11221122
# expected "ndarray[Any, Any]" [
1123-
dtype = start.dtype if start.dtype == end.dtype else np.dtype("int64")
1123+
if isinstance(start, int) or isinstance(end, int):
1124+
dtype = np.dtype("int64")
1125+
else:
1126+
dtype = start.dtype if start.dtype == end.dtype else np.dtype("int64")
11241127
breaks = maybe_downcast_numeric(
11251128
breaks, # type: ignore[arg-type]
1126-
dtype,
1129+
dtype
11271130
)
11281131
return IntervalIndex.from_breaks(breaks, name=name, closed=closed, dtype=IntervalDtype(subtype=dtype, closed=closed))
11291132
else:

0 commit comments

Comments
 (0)