def _upcast_blocks(blocks): """ Upcast and consolidate if necessary """ new_blocks = [] for block in blocks: if isinstance(block, IntBlock): newb = make_block(block.values.astype(float), block.items, block.ref_items, placement=block._ref_locs) elif isinstance(block, BoolBlock): newb = make_block(block.values.astype(object), block.items, block.ref_items, placement=block._ref_locs) else: newb = block new_blocks.append(newb) # use any ref_items return _consolidate(new_blocks, newb.ref_items)
def _upcast_blocks(blocks): """ Upcast and consolidate if necessary """ new_blocks = [] for block in blocks: if isinstance(block, IntBlock): newb = make_block(block.values.astype(float), block.items, block.ref_items) elif isinstance(block, BoolBlock): newb = make_block(block.values.astype(object), block.items, block.ref_items) else: newb = block new_blocks.append(newb) # use any ref_items return _consolidate(new_blocks, newb.ref_items)