I'm trying to determine the sentiment score for customer feedback using VADER in python. The simple code below is running perfectly for individual feedback and returning a dictionary of negative, neutral, positive and compound score.
Code:
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
feedback = "Food was very good"
vader = SentimentIntensityAnalyzer()
sentiment = vader.polarity_scores(feedback)
print(sentiment)
result: {'neg': 0.0, 'neu': 0.484, 'pos': 0.516, 'compound': 0.4927}
Now, I have a spreadsheet of 4k+ customer feedback. What I'm trying to do is to iterate through every feedback and add 4 new col as Negative_Score, Neutral_Score, Positive_Score and Compound_Score. I've written following code which is not giving desired result. Getting same score for every row. Any help will be appreciated.
Code:
import os.path
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
import pandas as pd
data = pd.read_excel(r"C:\...\sample_feedback.xlsx")
#Sample_feedback.xlsx has two col customer and feedbacktext
vader = SentimentIntensityAnalyzer()
data["Negative_Score"] = vader.polarity_scores(data["feedbacktext"]).get("neg")
data