Mergers Acquisitions Analysis

Overview

This project presents a sentiment analysis project focused on news articles related to mergers and acquisitions (M&A) in the tech industry, where natural language processing (NLP) techniques are applied to assess the media’s sentiment toward these corporate actions. News headlines from major tech companies engaged in M&A, including Palo Alto Networks, Dell Technologies, Cognizant Technology Solutions, Accenture, and CyberArk, were extracted and analyzed for sentiment, and an average polarity score was calculated to gauge public sentiment.

Data Extraction

Industry Selection

The analysis focused on major tech companies that are highly influential and publicly traded, including those listed on prominent stock exchanges such as Palo Alto Networks, Dell Technologies, Cognizant Technology Solutions, Accenture, and CyberArk. These companies were selected based on their relevance to recent mergers and acquisitions in the tech space and their significant media coverage.

Extracting News Headlines

Yahoo Finance news API collects news headlines related to each company. About eight news headlines per company are extracted to have a representative sample of media coverage.

A get_article_titles function takes the companies ticker symbol as input and retrieves the most recent news articles related to the company using Yahoo Finance API.

Using yfinance we extracted the news article titles for the titles listed in the excel file

Scraping Stock and Sentiment Data

For each article, use finance to retrieve historical stock price data from the days before and after the article was published. By comparing the stock prices, we can determine if the article had a positive or negative impact.

Impact Determination:

  • Positive Impact: If the stock price rises within a few days after the article, we assume the article has a positive effect.
  • Negative Impact: If the stock price decreases, the article likely has a negative effect.
  • Neutral Impact: Without significant change, the article might not have influenced the market.

Additionally, sentiment analysis tools are used on the article content to assess whether the article’s tone (positive or negative) aligns with the stock’s movement, further enhancing the understanding of market reactions to news.

sentiment analysis code

A final data frame is created with the company name, article title, article date, stock information and the sentiment scores.

df_final

Brand Reputation Analysis

The average polarity score is calculated for each company, considering the polarity scores of all news headlines associated with that company. This provides an overall measure of public sentiment toward the company. Based on the average polarity score, an online reputation category, which can be good, bad, or neutral, is assigned to each company. This design helps to understand the overall public perception of the company in the online environment.

The brand reputation was added to df_final to get a consolidated dataframe with all the required columns

Using groupby I found the overal sentiment of the selected companies.

Validation and Testing

Validation of Data Extraction

Validation of the data extraction process is done by manually checking that the data is consistent.

Validate whether the articles in the data frame match the article in Yahoo. Only Validate that the articles are relevant to mergers and acquisitions.

Cisco Technologies: 

This was done for all the selected companies. 

Validate whether the companies selected are public or private. For private companies, the stock data will not be available.

Testing Sentiment Analysis

To validate that the function created with the sentiment analysis libraries is correct, a test is performed where three statements are introduced: one positive, one neutral, and one negative. These are entered into the function, and the sentiment with which it was written is obtained correctly, thus corroborating that the sentiment analysis process is accurate.

Data Visualization

Polarity Analysis across Companies

The chart highlights that some companies, like DBX and TWLO, have more positive article sentiment, while others, like CSCO, reflect a slightly negative tone, indicating mixed perspectives in the coverage.

By looking at the chart:

  • CSCO (Cisco Systems): The polarity is negative (approximately -0.2), indicating an overall unfavorable sentiment in the articles.
  • CTSH (Cognizant Technology Solutions) and NET (Cloudflare): Both have a neutral polarity (0), suggesting that the articles were neither positive nor negative.
  • DBX (Dropbox): The highest positive polarity (around 0.47) indicates a favorable sentiment in the articles.
  • TWLO (Twilio): Shows a mildly positive polarity (around 0.25), indicating a generally favorable sentiment.

Sentiment Analysis vs Number of Titles

The chart represents the distribution of sentiment across news article titles. Most titles fall under the neutral category, suggesting the content is largely objective. A smaller number of titles reflect positive sentiment, while a few exhibit negative sentiment, indicating a mix of perspectives but with a heavier emphasis on neutrality.

Insights from this visualization:

  • Most article titles are neutral, indicating objective and factual reporting.
  • Positive sentiment titles are moderately frequent, suggesting favorable coverage.
  • Negative sentiment titles are minimal, reflecting limited critical perspectives.
  • Overall, most articles aim for neutrality, with a bias towards positive reporting.

 

Companies vs Number of Titles by Sentiment Analysis

The chart visualizes the number of article titles categorized by sentiment (negative, neutral, positive) for five companies. It highlights the variation in sentiment distribution across companies like Cisco, Cloudflare, Cognizant, Dropbox, and Twilio, revealing differing tones in the news coverage.

Insights from this visualization:

  • Cisco Systems has the only negative title, indicating critical coverage for the company.
  • Cloudflare and Cognizant receive neutral titles, suggesting an objective and factual tone in the articles.
  • Dropbox has entirely positive coverage, with no negative or neutral titles reflecting favorable reporting.
  • Twilio shows a balance, with positive and neutral sentiment, indicating a mix of favorable and neutral coverage.
  • Overall, there is a clear contrast between the companies, with Dropbox receiving the most positive coverage and Cisco facing negative sentiment.

WordCloud: Most Frequent Words in Companies Article Titles

The word cloud highlights the dominant themes across companies, with frequent mentions of “AI,” “Growth,” and “Stock” reflecting a focus on technological advancements and financial performance. Words like “Expands” and “Acquires” suggest significant business growth and mergers. This analysis helps identify common trends in industry reporting, emphasizing areas like artificial intelligence, cloud technology, and security.

Stock Open and Close Prices by Company

This line chart compares five companies’ stock opening and closing prices. Each company has two data points, with the blue line representing the stock’s opening price and the green line showing the closing price. The proximity of the two lines for each company highlights how little or how much the stock price changed throughout the trading period

For most companies, the stock open and close prices are closely aligned, with only small differences. However, there is significant variation in the stock prices across companies, particularly for Cisco Systems and Dropbox, where their stock prices show a notable decrease.

Sentiment vs Stock Prices for Selected Companies

This set of scatter plots visualizes the relationship between sentiment (negative, neutral, and positive) and stock prices (open and close) for five companies: Cognizant, Cloudflare, Cisco, Twilio, and Dropbox. Each plot shows the stock price movements (opening in blue and closing in green) against the sentiment score.

Brand Reputation by Company

This bar chart visualizes the brand reputation of five companies, categorized as either “Neutral” or “Good.” The count of mentions for each reputation level is represented, highlighting how each company’s brand is perceived. Companies like Twilio and Dropbox have received a “Good” reputation, while others such as Cognizant, Cloudflare, and Cisco are mainly categorized as “Neutral.” The chart clearly compares how these companies are viewed regarding their overall brand image.

Stock Price Trends for Selected Companies (Oct 2 - Oct 9, 2024)

This set of line charts tracks the stock opening and closing prices for five companies—Cognizant, Cloudflare, Cisco, Twilio, and Dropbox—over the period from October 2 to October 9, 2024. The blue line represents the stock opening prices, while the green line shows the closing prices. The charts allow for a comparison of how stock prices fluctuated throughout this period, highlighting the volatility or stability in stock performance for each company. Some companies, like Cloudflare and Twilio, show notable upward trends, while others, like Cisco, demonstrate more stable pricing.

Insights:

  • Cognizant Technology Solutions, Cloudflare Inc., and Cisco Systems Inc. predominantly have a good brand reputation.
  • Twilio Inc. has a Neutral brand reputation across all articles.
  • Dropbox Inc. shows an even balance between Good and Neutral brand reputations.
  • The dominance of good reputations suggests that these companies generally maintain positive market perception.

Result

In this project I explored the application of natural language processing (NLP) techniques for sentiment and stock analysis

Description

This project analyzes the impact of mergers and acquisitions (M&A) on stock prices and market sentiment. By collecting news articles from Yahoo Finance and stock data via yfinance, we applied sentiment analysis using VADER to classify headlines as positive, neutral, or negative. We then examined how stock prices reacted before and after M&A events for five major tech companies. The findings reveal that while sentiment influences stock movement, market conditions and investor expectations also play a key role. This project highlights how news sentiment can serve as an early indicator of stock performance and market trends.