# src/data_loader.py import pandas as pd def load_data(file_path: str) -> pd.DataFrame | None: try: if file_path.endswith('.csv'): df = pd.read_csv(file_path) elif file_path.endswith(('.xls', '.xlsx')): df = pd.read_excel(file_path) else: print("Unsupported file format.") return None # Basic validation: Ensure 'Department' column exists. # Subject-specific columns will be handled by the preprocessor. if 'Department' not in df.columns: print("Missing required column: 'Department'") return None print("Data loaded successfully (wide format).") return df except Exception as e: print(f"Error loading data: {e}") return None