@@ -2421,13 +2421,15 @@ def concat_same_type(self, to_concat, placement=None):
2421
2421
Concatenate list of single blocks of the same type.
2422
2422
"""
2423
2423
to_concat = [blk .values for blk in to_concat ]
2424
- values = _concat ._concat_categorical (to_concat )
2424
+ values = _concat ._concat_categorical (to_concat , axis = self . ndim - 1 )
2425
2425
2426
2426
if is_categorical_dtype (values .dtype ):
2427
2427
return self .make_block_same_class (
2428
2428
values , placement = placement or slice (0 , len (values ), 1 ))
2429
2429
else :
2430
- return make_block (values , placement = placement or slice (0 , len (values ), 1 ))
2430
+ return make_block (
2431
+ values , placement = placement or slice (0 , len (values ), 1 ),
2432
+ ndim = self .ndim )
2431
2433
2432
2434
2433
2435
class DatetimeBlock (DatetimeLikeBlockMixin , Block ):
@@ -2711,13 +2713,14 @@ def concat_same_type(self, to_concat, placement=None):
2711
2713
Concatenate list of single blocks of the same type.
2712
2714
"""
2713
2715
to_concat = [blk .values for blk in to_concat ]
2714
- values = _concat ._concat_datetime (to_concat )
2716
+ values = _concat ._concat_datetime (to_concat , axis = self . ndim - 1 )
2715
2717
2716
2718
if is_datetimetz (values ):
2717
2719
return self .make_block_same_class (
2718
2720
values , placement = placement or slice (0 , len (values ), 1 ))
2719
2721
else :
2720
- return make_block (values , placement = placement or slice (0 , len (values ), 1 ))
2722
+ return make_block (
2723
+ values , placement = placement or slice (0 , len (values ), 1 ))
2721
2724
2722
2725
2723
2726
class SparseBlock (NonConsolidatableMixIn , Block ):
@@ -5172,15 +5175,15 @@ def is_uniform_join_units(join_units):
5172
5175
"""
5173
5176
return (
5174
5177
# all blocks need to have the same type
5175
- all ([type (ju .block ) is type (join_units [0 ].block ) for ju in join_units ]) # noqa
5178
+ all ([type (ju .block ) is type (join_units [0 ].block ) for ju in join_units ]) and # noqa
5176
5179
# no blocks that would get missing values (can lead to type upcasts)
5177
- and all ([not ju .is_na for ju in join_units ])
5180
+ all ([not ju .is_na for ju in join_units ]) and
5178
5181
# no blocks with indexers (as then the dimensions do not fit)
5179
- and all ([not ju .indexers for ju in join_units ])
5182
+ all ([not ju .indexers for ju in join_units ]) and
5180
5183
# disregard Panels
5181
- and all ([ju .block .ndim <= 2 for ju in join_units ])
5184
+ all ([ju .block .ndim <= 2 for ju in join_units ]) and
5182
5185
# only use this path when there is something to concatenate
5183
- and len (join_units ) > 1 )
5186
+ len (join_units ) > 1 )
5184
5187
5185
5188
5186
5189
def get_empty_dtype_and_na (join_units ):
0 commit comments