File tree 2 files changed +26
-6
lines changed
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):
491
491
# coerce to object if needed
492
492
result = result .astype ('object' )
493
493
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):
1686
1686
return res
1687
1687
1688
1688
@classmethod
1689
- def _concat (self , to_concat ):
1689
+ def _concat (cls , to_concat ):
1690
1690
"""
1691
1691
Concatenate to_concat to single Index
1692
1692
"""
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 )
1698
1694
1699
1695
@classmethod
1700
1696
def _concat_same_dtype (cls , to_concat ):
You can’t perform that action at this time.
0 commit comments