Intro to Data Visualization
  • Introduction
  • Getting started
    • Introduction to Pandas
    • Accessing Files on Colab
    • Reviewing Data
      • Understanding type(data) in Pandas
    • Data Types
      • Categorical Data
      • Numeric Data
      • Temporal Data
      • Geographic Data
    • How to Check Data Type
    • Slicing and Subsetting DataFrames
    • Aggregating Data
  • Visualization Types
    • Exploratory Process
    • Explanatory Process
  • data exploration
    • Exploration Overview
    • Exploration with Plotly
      • Exploring Distributions
      • Exploring Relationships
      • Exploring with Regression Plots
      • Exploring Correlations
      • Exploring Categories
      • Exploring Time Series
      • Exploring Stocks with Candlestick
      • Exploring with Facets
      • Exploring with Subplots
    • Exploring with AI
  • Data Explanation
    • Data Explanation with Plotly
      • Using Text
      • Using Annotations
      • Using Color
      • Using Shape
      • Accessibility
      • Using Animations
    • Use Cases
  • Exercises and examples
    • Stock Market
      • Loading Yahoo! Finance Data
      • Use Cases for YF
      • Exploring YF Data
      • Understanding Boeing Data Over Time
      • Polishing the visualization
      • Analyzing with AI
      • Comparisons
    • The Gapminder Dataset
      • Loading the Gapminder Data
      • Use Cases
      • Exploring the Data
      • Exporting a Static Image
Powered by GitBook
On this page
  1. Exercises and examples
  2. Stock Market

Exploring YF Data

Background on Boeing and Stock Data for 2024 and 2025

Boeing Overview

Boeing is one of the world's leading aerospace companies, known for manufacturing commercial airplanes, defense equipment, and space technology. Founded in 1916, Boeing has played a pivotal role in aviation history, delivering iconic aircraft such as the 747 and 737 series. Its diverse product lineup includes commercial jets, military aircraft, satellites, and advanced technologies, making it a key player in both the aviation and defense sectors. Boeing's global presence and innovative solutions position it as a cornerstone of modern aviation and aerospace advancements.

Boeing Stock Data

Boeing's stock, traded under the ticker symbol BA on the New York Stock Exchange (NYSE), is closely monitored by investors due to its significance in the global economy and the aerospace sector. The stock's performance is influenced by factors such as:

  • Demand for commercial aircraft.

  • Government defense contracts.

  • Global economic conditions and travel trends.

  • Supply chain disruptions or advancements.

  • Research and development efforts in sustainable and advanced aviation technologies.

2024 and 2025 Stock Data Insights

Performance Trends:

In 2024, Boeing stock experienced fluctuations driven by recovery in global air travel post-pandemic, increasing demand for narrow-body aircraft, and ongoing challenges in supply chain management. Positive announcements regarding sustainable aviation initiatives and electric aircraft technologies also influenced investor sentiment.

In 2025, Boeing stock continued its upward trajectory, supported by robust airline orders, government contracts, and significant milestones in space exploration technologies. Innovations in fuel-efficient aircraft models and expanded services in aftermarket solutions further enhanced investor confidence.

Key Metrics:

  • Price Movements: The stock showed steady growth, reflecting increasing deliveries and financial recovery.

  • Volume: Trading volumes spiked during major announcements, such as the launch of new aircraft models or significant contract wins.

  • Sector Comparisons: Boeing's performance aligned closely with industry peers like Airbus, showcasing resilience amidst macroeconomic headwinds.

Market Impact:

Boeing's financial health and stock performance in 2024 and 2025 played a critical role in shaping the aerospace and defense industry. The company’s initiatives in sustainability and next-generation aircraft innovation are expected to drive long-term growth and maintain its position as an industry leader.

Script: Fetch and Visualize Boeing Stock Data

import yfinance as yf
import plotly.express as px
import pandas as pd

# Step 1: Fetch Boeing stock data
ticker = 'BA'  # Ticker symbol for Boeing
start_date = '2023-01-01'
end_date = '2025-12-31'

# Fetch historical data
boeing_data = yf.download(ticker, start=start_date, end=end_date)

# Step 2: Prepare the data
# Reset the index to make the 'Date' column accessible
boeing_data.reset_index(inplace=True)
boeing_data.columns = boeing_data.columns.to_flat_index()
boeing_data.columns = ['_'.join(col) for col in boeing_data.columns]
# Rename the columns  
boeing_data.columns = ["Date", "Close",	"High",	"Low",	"Open", "Volume"] # rename columns

# Filter for the columns we are interested in
boeing_data = boeing_data[['Date', 'Close']]  # 'Close' price represents the end-of-day stock price

# Step 3: Create the line chart
fig = px.line(
    boeing_data,
    x='Date',
    y='Close',
    title='Boeing Stock Price (2023-2025)',
    labels={'Close': 'Stock Price (USD)', 'Date': 'Date'},
)

# Step 4: Show the plot
fig.show()

Steps Explained:

  1. Fetch Data:

    • We use the yfinance library to download Boeing's historical stock prices from January 1, 2023, to December 31, 2025.

  2. Data Preparation:

    • The Close price is selected as it represents the stock price at the end of the trading day.

    • The index is reset to make the Date column accessible for plotting.

  3. Plot the Data:

    • A line chart is created using Plotly Express to visualize how Boeing's stock price has changed over time.

  4. Display:

    • The chart is displayed with clear axis labels and a descriptive title.

Requirements:

Install the required libraries if you don’t have them:

pip install yfinance plotly pandas
PreviousUse Cases for YFNextUnderstanding Boeing Data Over Time

Last updated 3 months ago