@@ -730,8 +730,7 @@ def _get_concatenated_data(self):
730
730
731
731
new_blocks = []
732
732
for kind in kinds :
733
- klass_blocks = [mapping .get (kind ) for mapping in blockmaps
734
- if kind in mapping ]
733
+ klass_blocks = [mapping .get (kind ) for mapping in blockmaps ]
735
734
stacked_block = self ._concat_blocks (klass_blocks )
736
735
new_blocks .append (stacked_block )
737
736
new_data = BlockManager (new_blocks , self .new_axes )
@@ -766,7 +765,8 @@ def _get_reindexed_data(self):
766
765
return reindexed_data
767
766
768
767
def _concat_blocks (self , blocks ):
769
- concat_values = np .concatenate ([b .values for b in blocks ],
768
+ concat_values = np .concatenate ([b .values for b in blocks
769
+ if b is not None ],
770
770
axis = self .axis )
771
771
772
772
if self .axis > 0 :
@@ -776,12 +776,13 @@ def _concat_blocks(self, blocks):
776
776
'DataFrames' )
777
777
return make_block (concat_values , blocks [0 ].items , self .new_axes [0 ])
778
778
else :
779
- all_items = [b .items for b in blocks ]
779
+ all_items = [b .items for b in blocks if b is not None ]
780
780
if self .axis == 0 and self .keys is not None :
781
781
offsets = np .r_ [0 , np .cumsum ([len (x ._data .axes [self .axis ]) for
782
782
x in self .objs ])]
783
783
indexer = np .concatenate ([offsets [i ] + b .ref_locs
784
- for i , b in enumerate (blocks )])
784
+ for i , b in enumerate (blocks )
785
+ if b is not None ])
785
786
concat_items = self .new_axes [0 ].take (indexer )
786
787
else :
787
788
concat_items = _concat_indexes (all_items )
0 commit comments