@@ -364,33 +364,15 @@ def get_result(self):
364
364
if self .axis == 0 :
365
365
name = com ._consensus_name_attr (self .objs )
366
366
367
- # concat Series with length to keep dtype as much
368
- non_empties = [x for x in self .objs if len (x ) > 0 ]
369
-
370
- # check if all series are of the same block type:
371
- if len (non_empties ) > 0 :
372
- blocks = [obj ._data .blocks [0 ] for obj in non_empties ]
373
- if all ([type (b ) is type (blocks [0 ]) for b in blocks [1 :]]): # noqa
374
- new_block = blocks [0 ].concat_same_type (blocks )
375
- if isinstance (new_block , SparseBlock ):
376
- cons = SparseSeries
377
- else :
378
- cons = Series
379
- return (cons (new_block , index = self .new_axes [0 ],
380
- name = name , fastpath = True )
381
- .__finalize__ (self , method = 'concat' ))
382
-
383
- if len (non_empties ) > 0 :
384
- values = [x ._values for x in non_empties ]
385
- else :
386
- values = [x ._values for x in self .objs ]
387
- new_data = _concat ._concat_compat (values )
367
+ mgr = self .objs [0 ]._data .concat ([x ._data for x in self .objs ],
368
+ self .new_axes )
388
369
389
- cons = _concat ._get_series_result_type (new_data )
370
+ if mgr ._block .is_sparse :
371
+ cons = SparseSeries
372
+ else :
373
+ cons = self .objs [0 ].__class__
390
374
391
- return (cons (new_data , index = self .new_axes [0 ],
392
- name = name , dtype = new_data .dtype )
393
- .__finalize__ (self , method = 'concat' ))
375
+ return cons (mgr , name = name ).__finalize__ (self , method = 'concat' )
394
376
395
377
# combine as columns in a frame
396
378
else :
0 commit comments