Skip to content

Instantly share code, notes, and snippets.

@roshan-adusumilli
Created May 23, 2020 02:21
Show Gist options
  • Select an option

  • Save roshan-adusumilli/9b07ae570736bf88cc047cd7545d9f10 to your computer and use it in GitHub Desktop.

Select an option

Save roshan-adusumilli/9b07ae570736bf88cc047cd7545d9f10 to your computer and use it in GitHub Desktop.
nltk.download('stopwords')
from nltk.corpus import stopwords
stop_words = set(stopwords.words('english'))
def remove_stopwords(tweet):
tweet = [n for n in tweet if not n in stop_words]
return tweet
ca_df['tweet_text'] = ca_df['tweet_text'].apply(remove_stopwords)
ny_df['tweet_text'] = ny_df['tweet_text'].apply(remove_stopwords)
tx_df['tweet_text'] = tx_df['tweet_text'].apply(remove_stopwords)
ca_df.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment