@@ -312,6 +312,14 @@ def ftype(self):
312
312
def merge (self , other ):
313
313
return _merge_blocks ([self , other ])
314
314
315
+ def concat_same_type (self , others ):
316
+ """
317
+ Concatenate list of single blocks of the same type.
318
+ """
319
+ values = np .concatenate ([self .values ] + [o .values for o in others ])
320
+ return self .make_block_same_class (
321
+ values , placement = slice (0 , len (values ), 1 ))
322
+
315
323
def reindex_axis (self , indexer , method = None , axis = 1 , fill_value = None ,
316
324
limit = None , mask_info = None ):
317
325
"""
@@ -2684,6 +2692,21 @@ def shift(self, periods, axis=0, mgr=None):
2684
2692
return [self .make_block_same_class (new_values ,
2685
2693
placement = self .mgr_locs )]
2686
2694
2695
+ def concat_same_type (self , others ):
2696
+ """
2697
+ Concatenate list of single blocks of the same type.
2698
+ """
2699
+ # can maybe replace
2700
+ # from pandas.core.dtypes.concat._concat_datetimetz ?
2701
+ to_concat = [self .values ] + [o .values for o in others ]
2702
+
2703
+ if len (set ([str (x .dtype ) for x in to_concat ])) != 1 :
2704
+ raise ValueError ('to_concat must have the same tz' )
2705
+
2706
+ values = to_concat [0 ]._concat_same_dtype (to_concat , None )
2707
+ return self .make_block_same_class (
2708
+ values , placement = slice (0 , len (values ), 1 ))
2709
+
2687
2710
2688
2711
class SparseBlock (NonConsolidatableMixIn , Block ):
2689
2712
""" implement as a list of sparse arrays of the same dtype """
0 commit comments