File tree Expand file tree Collapse file tree 2 files changed +26
-6
lines changed Expand file tree Collapse file tree 2 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -491,3 +491,27 @@ def convert_sparse(x, axis):
491491 # coerce to object if needed
492492 result = result .astype ('object' )
493493 return result
494+
495+
496+ def _concat_indexes (to_concat ):
497+ """
498+ Concatenate elements of to_concat to single Index
499+
500+ Parameters
501+ ----------
502+ to_concat : list-like of indexes
503+
504+ Returns
505+ -------
506+ a single index, preserving the combined dtypes
507+ """
508+
509+ if len (to_concat ) == 0 :
510+ from pandas .core .index import Index
511+ return Index ([])
512+
513+ typs = get_dtype_kinds (to_concat )
514+ if len (typs ) == 1 :
515+ return to_concat [0 ].__class__ ._concat_same_dtype (to_concat )
516+ else :
517+ return _concat_index_asobject (to_concat )
Original file line number Diff line number Diff line change @@ -1686,15 +1686,11 @@ def append(self, other):
16861686 return res
16871687
16881688 @classmethod
1689- def _concat (self , to_concat ):
1689+ def _concat (cls , to_concat ):
16901690 """
16911691 Concatenate to_concat to single Index
16921692 """
1693- typs = _concat .get_dtype_kinds (to_concat )
1694- if len (typs ) == 1 :
1695- return self ._concat_same_dtype (to_concat )
1696- else :
1697- return _concat ._concat_index_asobject (to_concat )
1693+ return _concat ._concat_indexes (to_concat )
16981694
16991695 @classmethod
17001696 def _concat_same_dtype (cls , to_concat ):
You can’t perform that action at this time.
0 commit comments