switch_model/tools/graph/main.py
def _load_dataframe(self, path, dtype=None, **kwargs) -> pd.DataFrame:
        """
        Reads a csv file for every scenario and returns a single dataframe containing
        the rows from every scenario with a column for the scenario name and index.
        """
        if dtype is None:
            dtype = {"generation_project": str, "gen_dbid": str, "GENERATION_PROJECT": str}

        df_all_scenarios: List[pd.DataFrame] = []
        for i, scenario in enumerate(self._scenarios):
            df = pd.read_csv(
                os.path.join(scenario.path, path), index_col=False,
                # Fix: force the datatype to str for some columns to avoid warnings of mismatched types
                dtype=dtype,
                sep=",",
                engine="c",
                **kwargs
            )
            df['scenario_name'] = scenario.name
            df['scenario_index'] = i
            df_all_scenarios.append(df)

        return pd.concat(df_all_scenarios)

        Reads a csv file for every scenario and returns a single dataframe containing
        the rows from every scenario with a column for the scenario name and index.
        
Reads a csv file for every scenario and returns a single dataframe containing
the rows from every scenario with a column for the scenario name and index.
Reads a csv file for every scenario and returns a single dataframe containing the rows from every scenario with a column for the scenario name and index .
def _load_dataframe(self, path, dtype=None, **kwargs) -> pd.DataFrame:
        if dtype is None:
            dtype = {"generation_project": str, "gen_dbid": str, "GENERATION_PROJECT": str}
        df_all_scenarios: List[pd.DataFrame] = []
        for i, scenario in enumerate(self._scenarios):
            df = pd.read_csv(
                os.path.join(scenario.path, path), index_col=False,
                dtype=dtype,
                sep=",",
                engine="c",
                **kwargs
            )
            df['scenario_name'] = scenario.name
            df['scenario_index'] = i
            df_all_scenarios.append(df)
        return pd.concat(df_all_scenarios)
def _load_dataframe ( self , path , dtype = None , ** kwargs ) -> pd . DataFrame : if dtype is None : dtype = { "generation_project" : str , "gen_dbid" : str , "GENERATION_PROJECT" : str } df_all_scenarios : List [ pd . DataFrame ] = [ ] for i , scenario in enumerate ( self . _scenarios ) : df = pd . read_csv ( os . path . join ( scenario . path , path ) , index_col = False , dtype = dtype , sep = "," , engine = "c" , ** kwargs ) df [ 'scenario_name' ] = scenario . name df [ 'scenario_index' ] = i df_all_scenarios . append ( df ) return pd . concat ( df_all_scenarios )
Reads a csv file for every scenario and returns a single dataframe containing
the rows from every scenario with a column for the scenario name and index.
Reads a csv file for every scenario and returns a single dataframe containing the rows from every scenario with a column for the scenario name and index .
"""
        Reads a csv file for every scenario and returns a single dataframe containing
        the rows from every scenario with a column for the scenario name and index.
        """ # Fix: force the datatype to str for some columns to avoid warnings of mismatched types
self
path
dtype