How to remove word from dataframe nad plot

Viewed 55

I created some plot with 20 popular words from tweet. enter image description here

But im not sure what is the best method to remove special character like ' between trump and business and says vote . I had tokenized my tweets. Append or replace ?

1 Answers

This is hard to do without knowing your code. But you can apply something like the following to the array or list that holds the most common words:

 words = [word for word in words if word != "'" and word != '"']

But really you should tokenize your tweets differently! You are likely tokenizing

Trump isn't Biden

as

["Trump", "isn", "'", "t", "Biden"]

which is where the ' and " likely come from. You should change it to

["Trump", "isn't", "Biden"]
Related