Created
December 18, 2018 09:50
-
-
Save jonathanoheix/3030a082a22f3c2f733ca26f9781e7d2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# add sentiment anaylsis columns | |
from nltk.sentiment.vader import SentimentIntensityAnalyzer | |
sid = SentimentIntensityAnalyzer() | |
reviews_df["sentiments"] = reviews_df["review"].apply(lambda x: sid.polarity_scores(x)) | |
reviews_df = pd.concat([reviews_df.drop(['sentiments'], axis=1), reviews_df['sentiments'].apply(pd.Series)], axis=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment