@@ -443,33 +443,14 @@ def join(self, other, how='left', level=None, return_indexers=False,
443
443
return super (RangeIndex , self ).join (other , how , level , return_indexers ,
444
444
sort )
445
445
446
- def append (self , other ):
447
- """
448
- Append a collection of Index options together
449
-
450
- Parameters
451
- ----------
452
- other : Index or list/tuple of indices
453
-
454
- Returns
455
- -------
456
- appended : RangeIndex if all indexes are consecutive RangeIndexes,
457
- otherwise Int64Index or Index
458
- """
459
-
460
- to_concat = [self ]
461
-
462
- if isinstance (other , (list , tuple )):
463
- to_concat = to_concat + list (other )
464
- else :
465
- to_concat .append (other )
446
+ def _concat_same_dtype (self , indexes ):
466
447
467
- if not all ([isinstance (i , RangeIndex ) for i in to_concat ]):
468
- return super (RangeIndex , self ).append ( other )
448
+ if not all ([isinstance (i , RangeIndex ) for i in indexes ]):
449
+ return super (RangeIndex , self )._concat_same_dtype ( indexes )
469
450
470
451
start = step = next = None
471
452
472
- for obj in to_concat :
453
+ for obj in indexes :
473
454
if not len (obj ):
474
455
continue
475
456
@@ -481,13 +462,13 @@ def append(self, other):
481
462
elif step is None :
482
463
# First non-empty index had only one element
483
464
if obj ._start == start :
484
- return super (RangeIndex , self ).append ( other )
465
+ return super (RangeIndex , self )._concat_same_dtype ( indexes )
485
466
step = obj ._start - start
486
467
487
468
non_consecutive = ((step != obj ._step and len (obj ) > 1 ) or
488
469
(next is not None and obj ._start != next ))
489
470
if non_consecutive :
490
- return super (RangeIndex , self ).append ( other )
471
+ return super (RangeIndex , self )._concat_same_dtype ( indexes )
491
472
492
473
if step is not None :
493
474
next = obj [- 1 ] + step
@@ -496,9 +477,7 @@ def append(self, other):
496
477
start = obj ._start
497
478
step = obj ._step
498
479
stop = obj ._stop if next is None else next
499
- names = set ([obj .name for obj in to_concat ])
500
- name = None if len (names ) > 1 else self .name
501
- return RangeIndex (start , stop , step , name = name )
480
+ return RangeIndex (start , stop , step )
502
481
503
482
def __len__ (self ):
504
483
"""
0 commit comments