def _prune(self, filename: str, df: pd.DataFrame) -> pd.DataFrame:
        """Depth-first search through the dependency graph
        and prune dependent DataFrames along the way.
        """
        dependencies = []
        for _, depf, data in self._config.out_edges(filename, data=True):
            deps = data.get("dependencies")
            if deps is None:
                msg = f"Edge missing `dependencies` attribute: {filename}->{depf}"
                raise ValueError(msg)
            dependencies.append((depf, deps))

        if not dependencies:
            return df

        for depfile, column_pairs in dependencies:
            # Read the filtered, cached file dependency
            depdf = self.get(depfile)
            for deps in column_pairs:
                col = deps[filename]
                depcol = deps[depfile]
                # If applicable, prune this dataframe by the other
                if col in df.columns and depcol in depdf.columns:
                    df = df[df[col].isin(depdf[depcol])]

        return df
def _prune ( self , filename : str , df : pd . DataFrame ) -> pd . DataFrame : dependencies = [ ] for _ , depf , data in self . _config . out_edges ( filename , data = True ) : deps = data . get ( "dependencies" ) if deps is None : msg = f"Edge missing `dependencies` attribute: {filename}->{depf}" raise ValueError ( msg ) dependencies . append ( ( depf , deps ) ) if not dependencies : return df for depfile , column_pairs in dependencies : depdf = self . get ( depfile ) for deps in column_pairs : col = deps [ filename ] depcol = deps [ depfile ] if col in df . columns and depcol in depdf . columns : df = df [ df [ col ] . isin ( depdf [ depcol ] ) ] return df
Depth-first search through the dependency graph
        and prune dependent DataFrames along the way.