import pandas as pd
from sklearn.model_selection import train_test_split

def load_data(file_path):
    """
    Load dataset from a CSV file.
    
    Args:
        file_path (str): Path to the CSV file.
        
    Returns:
        pd.DataFrame: Loaded dataset.
    """
    return pd.read_csv(file_path)

def preprocess_data(df):
    """
    Preprocess the dataset by handling missing values and encoding categorical variables.
    
    Args:
        df (pd.DataFrame): Raw dataset.
        
    Returns:
        pd.DataFrame: Preprocessed dataset.
    """
    # Handle missing values
    df = df.dropna()
    
    # Encode categorical variables
    df = pd.get_dummies(df)
    
    return df

def split_data(df, target_column, test_size=0.2):
    """
    Split the dataset into training and testing sets.
    
    Args:
        df (pd.DataFrame): Preprocessed dataset.
        target_column (str): Name of the target column.
        test_size (float): Proportion of the dataset to include in the test split.
        
    Returns:
        X_train, X_test, y_train, y_test: Split datasets.
    """
    X = df.drop(columns=[target_column])
    y = df[target_column]
    return train_test_split(X, y, test_size=test_size, random_state=42)