Skip to content

Instantly share code, notes, and snippets.

@shashankvemuri
Created May 25, 2020 03:19
Show Gist options
  • Save shashankvemuri/732bffcd00a46666df0b11527a980d14 to your computer and use it in GitHub Desktop.
Save shashankvemuri/732bffcd00a46666df0b11527a980d14 to your computer and use it in GitHub Desktop.
perform sentiment analysis
# Sentiment Analysis
analyzer = SentimentIntensityAnalyzer()
columns = ['Ticker', 'Date', 'Time', 'Headline']
news = pd.DataFrame(parsed_news, columns=columns)
scores = news['Headline'].apply(analyzer.polarity_scores).tolist()
df_scores = pd.DataFrame(scores)
news = news.join(df_scores, rsuffix='_right')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment