Skip to content

Commit 44800a4

Browse files
committed
Comment
1 parent d5c7d77 commit 44800a4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: pandas/core/dtypes/concat.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,11 @@ def convert_sparse(x, axis):
565565

566566

567567
def _concat_indexes_same_dtype_rangeindex(indexes):
568+
# Concatenates multiple RangeIndex instances. All members of "indexes" must
569+
# be of type RangeIndex; result will be RangeIndex if possible, Int64Index
570+
# otherwise. E.g.:
571+
# indexes = [RangeIndex(3), RangeIndex(3, 6)] -> RangeIndex(6)
572+
# indexes = [RangeIndex(3), RangeIndex(4, 6)] -> Int64Index([0,1,2,4,5])
568573

569574
start = step = next = None
570575

@@ -586,7 +591,9 @@ def _concat_indexes_same_dtype_rangeindex(indexes):
586591
non_consecutive = ((step != obj._step and len(obj) > 1) or
587592
(next is not None and obj._start != next))
588593
if non_consecutive:
589-
# Not nice... but currently what happens in NumericIndex:
594+
# Int64Index._append_same_dtype([ix.astype(int) for ix in indexes])
595+
# would be preferred... but it currently resorts to
596+
# _concat_index_asobject anyway.
590597
return _concat_index_asobject(indexes)
591598

592599
if step is not None:

0 commit comments

Comments
 (0)