Skip to content

mn-cs/data-science-analysis-projects

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tesla & GameStop Stock and Revenue Analysis

This project analyzes the historical stock prices and quarterly revenue trends of Tesla (TSLA) and GameStop (GME) using Python. It demonstrates data extraction, cleaning, and visualization techniques suitable for financial data analysis.

Project Structure

├── data/
│   ├── processed/
│   │   ├── GME_revenue_clean.csv
│   │   └── TSLA_revenue_clean.csv
│   └── raw/
│       ├── GME_stock_raw.csv
│       └── TSLA_stock_raw.csv
├── notebooks/
│   └── tesla_gme_stock_analysis.ipynb
├── src/
│   ├── __init__.py
│   ├── data_loader.py
│   ├── paths.py
│   └── visualize.py
├── pyproject.toml
└── README.md

Status

Actively maintained and being improved with additional features and analyses.

Main Features

  • Automated data download: Fetches historical stock data from Yahoo Finance using yfinance.
  • Web scraping: Extracts and cleans quarterly revenue data from web sources using pandas.read_html.
  • Data cleaning: Handles missing values, removes formatting, and ensures numeric types.
  • Visualization: Plots stock and revenue trends using Plotly.
  • Reproducibility: Saves all processed and raw data to disk for future use.

How to Run

  1. Clone the repository and install dependencies (see pyproject.toml).
  2. Activate your Python environment.
  3. Run the Jupyter notebook notebooks/tesla_gme_stock_analysis.ipynb to reproduce the analysis and visualizations.

Key Scripts

  • src/data_loader.py: Functions for downloading, scraping, and cleaning data.
  • src/visualize.py: Functions for plotting stock and revenue trends.
  • src/paths.py: Centralized paths for data directories.

Data Sources

  • Stock prices: Yahoo Finance (via yfinance)
  • Revenue tables: IBM Skills Network sample project URLs

Example Usage

from src.data_loader import fetch_and_save_stock_data, fetch_clean_revenue_data

tesla_data = fetch_and_save_stock_data("TSLA")
gme_data = fetch_and_save_stock_data("GME")

tesla_revenue = fetch_clean_revenue_data(tesla_url, "TSLA")
gme_revenue = fetch_clean_revenue_data(gme_url, "GME")

License

This project is for educational purposes.

About

Stock and revenue analysis of Tesla and GameStop using Python, data scraping, and visualization

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors