我希望能够创建散点图和折线图,并找出比特币的价格与人们推文的情绪之间是否存在关系。我有一列是复合、正面、中性和负面的,我希望它们显示比特币价格与人们情绪之间的关系。有人可以推荐一个解决方案,说明如何应用各种数据可视化技术来显示比特币情绪与价格之间的关系吗?也许像散点图或折线图。谢谢!
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
analyzer = SentimentIntensityAnalyzer()
df=pd.read_csv('cleaned_with_price.csv', header = 0)
df2 = df.drop(['Unnamed: 0', 'id', 'fullname', 'url', 'timestamp', 'replies', 'likes', 'retweets'], axis=1)
## removed unnecesarry stuff
tweets_list = df2['text'].tolist()
tweet_df = pd.DataFrame(tweets_list, columns = ['Tweet'])
tweet_df
这给出了这个,
## add columns for each score in the dataframe
tweet_df.Tweet = tweet_df.Tweet.astype('str')
df2['Compound'] = [analyzer.polarity_scores(twt)['compound'] for twt in tweet_df['Tweet']]
df2['Positive'] = [analyzer.polarity_scores(twt)['pos'] for twt in tweet_df['Tweet']]
df2['Neutral'] = [analyzer.polarity_scores(twt)['neu'] for twt in tweet_df['Tweet']]
df2['Negative'] = [analyzer.polarity_scores(twt)['neg'] for twt in tweet_df['Tweet']]
df2
哪个输出:
有人可以推荐一个解决方案,说明如何应用各种数据可视化技术来显示比特币情绪与价格之间的关系吗?