def finalize(self):
        assert not self._finalized

        # cache all dataframes and column sets
        for ctx_id in list(self.context_handler_dict.keys()):
            for node in self.nodes:
                self._cached_columns[(ctx_id, node)] = self.get_columns(node, ctx_id)
            self._cached_dataframes[ctx_id] = self.get_dataframe(ctx_id)
            
            # delete the data for that context in case we're low on memory
            del self.context_handler_dict[ctx_id]

        # this should be empty now
        assert len(self.context_handler_dict) == 0

        # snap the version number if it's not already been taken (see __call__)
        if not hasattr(self, "_version_"):
            self._version_ = self.__version__

        self._finalized = True
Throw away intermediate structures and just retain any dataframes
dataset/ETHPy150Open manahl/mdf/mdf/builders/basic.py/DataFrameBuilder.finalize