@@ -541,36 +541,37 @@ def _concat_rangeindex_same_dtype(indexes):
541
541
"""
542
542
from pandas import Int64Index , RangeIndex
543
543
544
- start = step = next = None
544
+ start = step = next_ = None
545
545
546
546
# Filter the empty indexes
547
547
non_empty_indexes = [obj for obj in indexes if len (obj )]
548
548
549
549
for obj in non_empty_indexes :
550
+ rng = obj ._range # type: range
550
551
551
552
if start is None :
552
553
# This is set by the first non-empty index
553
- start = obj . _start
554
- if step is None and len (obj ) > 1 :
555
- step = obj . _step
554
+ start = rng . start
555
+ if step is None and len (rng ) > 1 :
556
+ step = rng . step
556
557
elif step is None :
557
558
# First non-empty index had only one element
558
- if obj . _start == start :
559
+ if rng . start == start :
559
560
return _concat_index_same_dtype (indexes , klass = Int64Index )
560
- step = obj . _start - start
561
+ step = rng . start - start
561
562
562
- non_consecutive = ((step != obj . _step and len (obj ) > 1 ) or
563
- (next is not None and obj . _start != next ))
563
+ non_consecutive = ((step != rng . step and len (rng ) > 1 ) or
564
+ (next_ is not None and rng . start != next_ ))
564
565
if non_consecutive :
565
566
return _concat_index_same_dtype (indexes , klass = Int64Index )
566
567
567
568
if step is not None :
568
- next = obj [- 1 ] + step
569
+ next_ = rng [- 1 ] + step
569
570
570
571
if non_empty_indexes :
571
572
# Get the stop value from "next" or alternatively
572
573
# from the last non-empty index
573
- stop = non_empty_indexes [- 1 ]._stop if next is None else next
574
+ stop = non_empty_indexes [- 1 ].stop if next_ is None else next_
574
575
return RangeIndex (start , stop , step )
575
576
576
577
# Here all "indexes" had 0 length, i.e. were empty.
0 commit comments