-
-
Save amankharwal/386f0c0d76fe3c9cdf89db0783d4b344 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
sid = SIA() | |
f_data['sentiments'] = f_data['text'].apply(lambda x: sid.polarity_scores(' '.join(re.findall(r'\w+',x.lower())))) | |
f_data['Positive Sentiment'] = f_data['sentiments'].apply(lambda x: x['pos']+1*(10**-6)) | |
f_data['Neutral Sentiment'] = f_data['sentiments'].apply(lambda x: x['neu']+1*(10**-6)) | |
f_data['Negative Sentiment'] = f_data['sentiments'].apply(lambda x: x['neg']+1*(10**-6)) | |
f_data.drop(columns=['sentiments'],inplace=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment