File size: 503 Bytes
9142902
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# utils/helper.py
# Basic helper functions used across the project

import pandas as pd

def load_csv(path):
    """Safely loads a CSV file."""
    try:
        df = pd.read_csv(path)
        print(f"✅ Loaded file: {path} ({len(df)} rows)")
        return df
    except FileNotFoundError:
        print(f"⚠️ File not found: {path}")
        return pd.DataFrame()

def save_csv(df, path):
    """Saves a DataFrame as CSV."""
    df.to_csv(path, index=False)
    print(f"💾 Data saved to {path}")