Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created October 1, 2020 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/bbc46c9afa9c3fc1fee14d3a007d22c7 to your computer and use it in GitHub Desktop.
Save amankharwal/bbc46c9afa9c3fc1fee14d3a007d22c7 to your computer and use it in GitHub Desktop.
def find_pol(review):
return TextBlob(review).sentiment.polarity
trump_reviews["Sentiment Polarity"] = trump_reviews["text"].apply(find_pol)
print(trump_reviews.tail())
biden_reviews["Sentiment Polarity"] = biden_reviews["text"].apply(find_pol)
print(biden_reviews.tail())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment