Jeff Bezos has been approached to buy a stake in Liverpool FC. Amazon already holds the Premier League TV rights.
Back to Tutorials
businessTutorialbeginner

Jeff Bezos has been approached to buy a stake in Liverpool FC. Amazon already holds the Premier League TV rights.

July 23, 202648 views6 min read

Learn how to analyze sports team ownership data using Python, including data creation, cleaning, analysis, and visualization techniques.

Introduction

In this tutorial, we'll explore how to analyze sports team ownership data using Python and basic data analysis techniques. While the news article discusses Jeff Bezos potentially buying a stake in Liverpool FC, we'll focus on building practical skills for working with real-world datasets that could include ownership information, financial data, and team performance metrics. This tutorial will teach you how to collect, clean, and analyze data related to sports team ownership using Python.

Prerequisites

Before starting this tutorial, you should have:

  • Basic understanding of Python programming
  • Python installed on your computer (we recommend Python 3.7 or higher)
  • Basic knowledge of data analysis concepts
  • Installed libraries: pandas, numpy, matplotlib

To install the required libraries, run:

pip install pandas numpy matplotlib

Step-by-step instructions

Step 1: Setting Up Your Python Environment

Creating a new Python file

First, create a new Python file called football_analysis.py. This will be our main file for analyzing sports team data. The reason we're starting with a clean file is that we'll be building up our analysis step by step, and it's easier to track our progress this way.

Importing necessary libraries

At the top of your file, add the following imports:

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

# Set up plotting style
plt.style.use('seaborn-v0_8')

We're importing pandas for data manipulation, numpy for numerical operations, and matplotlib for creating visualizations. The matplotlib style setting makes our charts look more professional.

Step 2: Creating Sample Data for Analysis

Generating mock ownership data

Since we don't have real ownership data for Liverpool FC, we'll create a sample dataset that mimics what we might see in real-world scenarios:

# Create sample data for football teams and their ownership
ownership_data = {
    'team': ['Liverpool FC', 'Manchester United', 'Chelsea', 'Arsenal', 'Manchester City'],
    'current_owner': ['Fenway Sports Group', 'Glazer Family', 'Todd Boehly', 'Wesley Edens', 'Sheikh Mansour'],
    'ownership_percentage': [70, 60, 40, 30, 100],
    'purchase_price_millions': [1350, 1000, 2000, 1500, 300],
    'year_of_purchase': [2022, 2005, 2022, 2021, 2008],
    'stake_offered': [30, 25, 40, 35, 100],
    'financial_status': ['High', 'Medium', 'High', 'Medium', 'High']
}

df = pd.DataFrame(ownership_data)
print(df)

This creates a dataset with various teams and their ownership information. The sample data includes team names, current owners, ownership percentages, purchase prices, and other relevant details.

Step 3: Exploring the Data

Understanding our dataset structure

Let's examine what we've created:

# Display basic information about the dataset
print("Dataset shape:", df.shape)
print("\nDataset info:")
df.info()
print("\nFirst few rows:")
print(df.head())

This step helps us understand what data we're working with. The shape tells us how many rows and columns we have, while info() shows the data types of each column.

Basic statistics of the data

Let's get some basic statistics:

# Display basic statistics
print("\nBasic statistics:")
print(df.describe())

The describe() function gives us insights into the numerical columns, showing measures like mean, standard deviation, minimum, and maximum values.

Step 4: Data Cleaning and Preparation

Handling missing or inconsistent data

Real-world data often has issues. Let's make sure our data is clean:

# Check for missing values
print("\nMissing values:")
print(df.isnull().sum())

# Check for duplicate rows
print("\nDuplicate rows:")
print(df.duplicated().sum())

# If we had missing values, we would handle them like this:
# df = df.dropna()  # Remove rows with missing values
# or
# df = df.fillna(0)  # Fill missing values with 0

Checking for missing values and duplicates is crucial because they can affect our analysis results. This step ensures our data is reliable for analysis.

Step 5: Analyzing Ownership Data

Comparing ownership percentages

Let's analyze which teams have the highest ownership percentages:

# Sort teams by ownership percentage
sorted_by_ownership = df.sort_values('ownership_percentage', ascending=False)
print("\nTeams sorted by ownership percentage:")
print(sorted_by_ownership[['team', 'ownership_percentage']])

This sorting helps us quickly identify which teams have the most concentrated ownership, which is relevant to the Liverpool FC news.

Calculating purchase price per stake

Let's calculate the price per percentage point of ownership:

# Calculate price per percentage point
df['price_per_percent'] = df['purchase_price_millions'] / df['ownership_percentage']

print("\nPrice per percentage point:")
print(df[['team', 'price_per_percent']])

This calculation helps us understand the valuation of each team's ownership stake, which is important for understanding the financial aspects of sports team purchases.

Step 6: Creating Visualizations

Visualizing ownership percentages

Let's create a bar chart to visualize ownership percentages:

# Create a bar chart of ownership percentages
plt.figure(figsize=(10, 6))
bars = plt.bar(df['team'], df['ownership_percentage'], color='skyblue')

# Add value labels on bars
for bar in bars:
    height = bar.get_height()
    plt.text(bar.get_x() + bar.get_width()/2., height,
             f'{height:.0f}%',
             ha='center', va='bottom')

plt.title('Ownership Percentage by Team')
plt.xlabel('Team')
plt.ylabel('Ownership Percentage')
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()

Visualizations make data more accessible and help identify patterns that might not be obvious in raw numbers. This chart clearly shows which teams have the highest ownership concentrations.

Price vs. Ownership scatter plot

Let's create another visualization to show the relationship between purchase price and ownership:

# Create a scatter plot
plt.figure(figsize=(10, 6))
plt.scatter(df['ownership_percentage'], df['purchase_price_millions'], s=100, alpha=0.7)

# Add team labels
for i, team in enumerate(df['team']):
    plt.annotate(team, (df['ownership_percentage'][i], df['purchase_price_millions'][i]),
                xytext=(5, 5), textcoords='offset points')

plt.title('Purchase Price vs. Ownership Percentage')
plt.xlabel('Ownership Percentage')
plt.ylabel('Purchase Price (Millions £)')
plt.grid(True, alpha=0.3)
plt.show()

This scatter plot helps us visualize the relationship between how much teams cost to buy and what percentage of ownership they represent.

Step 7: Making Data-Driven Insights

Summarizing key findings

Let's create a summary of our findings:

# Create a summary of key insights
print("\n=== DATA ANALYSIS SUMMARY ===")
print(f"Total teams analyzed: {len(df)}")
print(f"Average ownership percentage: {df['ownership_percentage'].mean():.1f}%")
print(f"Average purchase price: £{df['purchase_price_millions'].mean():.1f} million")
print(f"Highest ownership percentage: {df['ownership_percentage'].max()}%")
print(f"Lowest purchase price: £{df['purchase_price_millions'].min()} million")

# Find the most expensive stake per percentage point
most_expensive = df.loc[df['price_per_percent'].idxmax()]
print(f"\nMost expensive stake per percentage point: {most_expensive['team']} (£{most_expensive['price_per_percent']:.1f} million per %)")

This summary gives us a quick overview of what our data reveals, which is essential for communicating findings to others.

Summary

In this tutorial, we've learned how to work with sports team ownership data using Python. We created a sample dataset, explored it, cleaned it, and performed basic analysis. We also created visualizations to better understand the data patterns. This approach can be applied to real-world scenarios like analyzing the Liverpool FC ownership situation, where understanding ownership structures and financial investments is crucial.

The skills you've learned here are fundamental to data analysis in sports business, finance, and investment sectors. You can extend this analysis by adding more data points, incorporating real financial data, or using more advanced statistical techniques.

Source: TNW Neural

Related Articles