def clean_data(df):
    """
    Function will be used to clean the dataset.

    Parameters
    ----------
    df: DataFrame
        A dataframe containing the the heart disease data.
    
    Returns
    -------
    df: DataFrame
        A dataframe containing the cleansed heart disease data.
    """
    df['sex'][df['sex'] == 0] = 'female'
    df['sex'][df['sex'] == 1] = 'male'

    df['chest_pain_type'][df['chest_pain_type'] == 0] = 'typical angina'
    df['chest_pain_type'][df['chest_pain_type'] == 1] = 'atypical angina'
    df['chest_pain_type'][df['chest_pain_type'] == 2] = 'non-anginal pain'
    df['chest_pain_type'][df['chest_pain_type'] == 3] = 'asymptomatic'

    df['fasting_blood_sugar'][df['fasting_blood_sugar'] == 0] = 'lower than 120mg/ml'
    df['fasting_blood_sugar'][df['fasting_blood_sugar'] == 1] = 'greater than 120mg/ml'

    df['rest_ecg'][df['rest_ecg'] == 0] = 'normal'
    df['rest_ecg'][df['rest_ecg'] == 1] = 'ST-T wave abnormality'
    df['rest_ecg'][df['rest_ecg'] == 2] = 'left ventricular hypertrophy'

    df['exercise_induced_angina'][df['exercise_induced_angina'] == 0] = 'no'
    df['exercise_induced_angina'][df['exercise_induced_angina'] == 1] = 'yes'

    df['st_slope'][df['st_slope'] == 0] = 'upsloping'
    df['st_slope'][df['st_slope'] == 1] = 'flat'
    df['st_slope'][df['st_slope'] == 2] = 'downsloping'

    df['thalassemia'][df['thalassemia'] == 0] = 'normal'
    df['thalassemia'][df['thalassemia'] == 1] = 'fixed defect'
    df['thalassemia'][df['thalassemia'] == 2] = 'reversable defect'
    df['thalassemia'][df['thalassemia'] == 3] = 'reversable defect'

    return df