Last active
December 15, 2020 17:36
-
-
Save devamitranjan/5ecfe4d3ad1911ebd7f1eaad650d8d8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from textblob.blob import TextBlob | |
def find_polarity_of_single_comment(text): | |
return TextBlob(text).sentiment.polarity | |
def find_polarity_of_every_comment(df): | |
df['Polarity'] = df['Comments'].apply(find_polarity_of_single_comment) | |
return df | |
df = find_polarity_of_every_comment(df) | |
df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment