有没有人有办法计算每天的平均情绪值?这是我的代码得到了情绪得分,但我试着计算了一天的平均,但我没有任何运气。
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'])

发布于 2022-02-13 23:31:03
尝试使用groupby和agg来解决这个问题。
eth.groupby(‘日期’)‘情感值’..agg(‘平均’)
https://stackoverflow.com/questions/71105722
复制相似问题