@@ -2139,12 +2139,15 @@ def cat(self, others=None, sep=None, na_rep=None, join=None):
2139
2139
# if join is None, _get_series_list already aligned indexes
2140
2140
join = 'left' if join is None else join
2141
2141
2142
- # Need to add keys for uniqueness in case of duplicate columns
2143
- others = concat (others , axis = 1 ,
2144
- join = (join if join == 'inner' else 'outer' ),
2145
- keys = range (len (others )))
2146
- data , others = data .align (others , join = join )
2147
- df = concat ([data , others ], axis = 1 ).astype ('object' )
2142
+ if any (not data .index .equals (x .index ) for x in others ):
2143
+ # Need to add keys for uniqueness in case of duplicate columns
2144
+ others = concat (others , axis = 1 ,
2145
+ join = (join if join == 'inner' else 'outer' ),
2146
+ keys = range (len (others )), copy = False )
2147
+ data , others = data .align (others , join = join )
2148
+ df = concat ([data , others ], axis = 1 , copy = False ).astype ('object' )
2149
+ else :
2150
+ df = concat ([data ] + others , axis = 1 , copy = False ).astype ('object' )
2148
2151
2149
2152
# calculate in numpy using str_cat_core; result is 1-dim np.ndarray
2150
2153
if na_rep is None :
0 commit comments