import pandas as pd

import pandas as pd

def load_csv(file_path):
    """Loads the csv file and ensures that missing values are being handled correctly """
    if not isinstance(file_path, str) or not file_path.endswith('.csv'):
        raise ValueError("The file path is either wrong on the file is not a .csv file")

    df = pd.read_csv(file_path).fillna("None")
    if "referral" in df.columns:
        df["referral"] = df["referral"].replace({1.0: "Need Referral", 0.0: "No Need for Referral"})
    
    return df


def filter_referrals(df):
    if "referral" in df.columns:
        return df[df["referral"] == "Need Referral"].copy()
    return df

def reset_table(df):
    return df.copy()