def clean_data(data):
    """
    Takes a Pandas Dataframe and cleans and updates string values to 
    prepare for import into Neo4j. Also generates some new features.

    Parameters
    ----------
    data : Pandas Dataframe
        Dataframe of Titanic dataset loaded from .csv

    Columns Fixed
    -------------
        - embarked
        - home.dest
    
    Columns Created
    ---------------
        - family.size
        - surname
        - deck

    Returns
    -------
    Pandas Dataframe
        Dataframe ready for import into property graph database

    """
    # Calculate total size of family (same surname) including passenger
    data['family.size'] = data['sibsp'] + data['parch'] + 1

    # Add surname column to easily identify relatives. Neo4j can 
    # build relationships based on matching surname and family size.
    data['surname'] = data['name'].str.split(',', expand=True)[0]

    # Extract deck from cabin number
    data['deck'] = data['cabin'].str[:1]
    
    # Fill incorrect NaN values of embarked with correct values for passengers
    data.loc[data['ticket'] == '113572', 'embarked'] = 'S'
    
    # Replace embarked with location name
    embarked = {"S": "Southampton", "C": "Cherbourg", "Q": "Queenstown"}
    data['embarked'] = data['embarked'].map(embarked)
    
    # Replace NaN values with Unknown in destination column
    data['home.dest'].fillna("Unspecified Destination", inplace=True)
    
    return data