def clean_data(df):
    """
    This function cleans data from the provided dataframe
    
    Parameters: df is the dataframe with the messages and categories
    Return:     df is the dataframe already clean with no duplicates
    """

    print("df shape=",df.shape)

    duplicate = df[df.duplicated()]
    print("df shape of duplicates=",duplicate.shape )
    
    # drop duplicates
    df.drop_duplicates(inplace=True)

    # check number of duplicates
    duplicate = df[df.duplicated()]
    print("df shape with no duplicates=",duplicate.shape )
    print("Dataframes columns = ", df.columns)    
    print("Dataframe head=",df.head())    

    df['related'] = df['related'].astype('str').str.replace('2', '1')
    df['related'] = df['related'].astype('int')
    return df