0

I have a DataFrame that contains tweets and I am trying to remove all emojis but for some reason it is not working. I get a new columns with the emojis still there. Any advise would be appreciated

[![DF][1]][1]

def give_emoji_free_text(text):
    """
    Removes emoji's from tweets
    Accepts:
        Text (tweets)
    Returns:
        Text (emoji free tweets)
    """
    emoji_list = [c for c in text if c in emoji.UNICODE_EMOJI]
    clean_text = ' '.join([str for str in text.split() if not any(i in str for i in emoji_list)])
    return clean_text



# Apply the function above and get tweets free of emoji's
df['emoji_free_tweets']=df['tweet text'].apply(lambda x:give_emoji_free_text(x))

'''


  [1]: https://i.stack.imgur.com/UKgOa.png
DayTrader
  • 58
  • 6

0 Answers0