def clean_data(df, new_name=None):
    """
    Clean the given data and perform basic cleaning operations
    :param df: The DataFrame extracted from given whatsapp chats
    :type df: DataFrame
    :param new_name: list of names if you want to replace senders name to something shorter
    :type new_name: List
    :return: Cleaned DataFrame
    :rtype: DataFrame
    """

    if new_name:
        original_name = df["from"].unique().tolist()
        df.replace(original_name, new_name, inplace=True)
    df.dropna(subset=['text'], inplace=True)
    df.set_index('time', inplace=True, drop=False)
    return df