This project involves extracting and visualizing stock data for Tesla and GameStop using a Jupyter Notebook. Using the yfinance
library, historical stock data is retrieved and plotted. Additionally, web scraping techniques are employed to extract revenue data for both companies. The project is structured as follows:
- Define a Function that Makes a Graph: A function is created to facilitate the plotting of graphs.
- Extract Stock Data using yfinance: Historical stock data for Tesla and GameStop is extracted using the
yfinance
library. - Webscraping for Revenue Data: Revenue data for Tesla and GameStop is extracted from the web using web scraping techniques.
- Plotting Stock and Revenue Data: The extracted data is visualized using graphs to provide a clear and concise representation of the stock and revenue trends.
This project was completed as part of the IBM Python Project for Data Science course.
- Python 3.x
yfinance==0.1.67
beautifulsoup4==4.10.0
requests
nbformat==4.2.0
plotly
notebook
(Jupyter Notebook)
- Clone the repository:
git clone https://github.com/your-username/stock-data-analysis.git
- Install the required libraries:
pip install yfinance==0.1.67 mamba install bs4==4.10.0 -y pip install nbformat==4.2.0 pip install plotly pip install notebook
- Navigate to the project directory:
cd stock-data-analysis
- Launch Jupyter Notebook:
jupyter notebook
- Open the Jupyter Notebook file (
.ipynb
) in the Jupyter interface. - Follow the steps in the notebook to:
- Import the required libraries:
import yfinance as yf import pandas as pd import requests from bs4 import BeautifulSoup import plotly.graph_objects as go from plotly.subplots import make_subplots
- Extract stock data using
yfinance
. - Extract revenue data using web scraping.
- Plot the stock and revenue data using
plotly
.
- Import the required libraries: