Daily Sentiment Values

90 Views Asked by At

Does anyone have an idea into calculating the average sentiment values for each day? This is my code get get the sentiment score, but I have tried calculating an average for each of the day, but i havent had any luck

from nltk.sentiment.vader import SentimentIntensityAnalyzer
import pandas as pd
analyzer = SentimentIntensityAnalyzer()

eth = pd.read_csv("Ethereum_2020_2021_Time_Adjusted.csv")
eth['Sentiment Values'] = eth['Title'].apply(lambda Title: analyzer.polarity_scores(Title))
eth['Title Sentiment Score']  = eth['Sentiment Values'].apply(lambda score_dict: score_dict['compound'])

enter image description here

1

There are 1 best solutions below

0
Mehdi Shishehbor On BEST ANSWER

Try using groupby and agg to address the issue.

eth.groupby('Date')['Sentiment Values'].agg('mean')