Last active
December 15, 2020 17:35
-
-
Save devamitranjan/a8bf90a8d4d36335ee7f0c3c11c9c81e 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_subjectivity_on_single_comment(text): | |
return TextBlob(text).sentiment.subjectivity | |
def apply_subjectivity_on_all_comments(df): | |
df['Subjectivity'] = df['Comments'].apply(find_subjectivity_on_single_comment) | |
return df | |
df = apply_subjectivity_on_all_comments(df) | |
df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment