import pandas as pd import os class DataLoader: @staticmethod def load(filepath: str, index_col: str = None) -> pd.DataFrame: """ Load different datasets """ if not os.path.exists(filepath): raise FileNotFoundError(f"File not found: {filepath}") if filepath.endswith('.parquet'): df = pd.read_parquet(filepath) if index_col is not None: df = df.set_index(index_col) elif filepath.endswith('.csv'): df = pd.read_csv(filepath, index_col=index_col) else: raise ValueError(f"File format not supported for file: {filepath}") return df