diff --git a/src/utils.py b/src/utils.py deleted file mode 100644 index 481a50f2ca223e3a020279773abeebdd05d68622..0000000000000000000000000000000000000000 --- a/src/utils.py +++ /dev/null @@ -1,30 +0,0 @@ -from pathlib import Path -import pandas as pd -import os - -def load_dataset(filename, folder="raw", base_path=None): - """ - Load a dataset from a specific folder path using pandas. - - Parameters: - filename (str): The name of the file (e.g., "data.csv"). - folder (str): The subfolder inside the data directory (default is "raw"). - base_path (str or Path): Base path to the data directory. If None, defaults to two levels up from this script. - - Returns: - pd.DataFrame: Loaded dataset. - """ - if base_path is None: - base_path = Path(__file__).resolve().parents[2] / "data" - - file_path = base_path / folder / filename - - if not file_path.exists(): - raise FileNotFoundError(f"⌠File not found: {file_path}") - - try: - df = pd.read_csv(file_path) - print(f"✅ Loaded dataset from: {file_path}") - return df - except Exception as e: - raise RuntimeError(f"âš ï¸ Failed to load dataset: {e}")