Introduction
In this tutorial, you'll learn how to use Python to analyze and visualize data related to food delivery services like Just Eat Takeaway. We'll focus on creating a simple dashboard that can help you understand delivery patterns, revenue trends, and business performance metrics - similar to what investors like Prosus might analyze when evaluating their investments.
This tutorial will teach you how to work with real-world data using Python libraries like pandas, matplotlib, and seaborn. You'll create visualizations that can help make sense of business metrics and trends.
Prerequisites
Before starting this tutorial, you'll need:
- A computer with Python installed (version 3.6 or higher)
- Basic understanding of Python programming concepts
- Some familiarity with data analysis and visualization concepts
Step-by-Step Instructions
1. Install Required Python Libraries
First, you need to install the necessary Python libraries for data analysis and visualization. Open your terminal or command prompt and run:
pip install pandas matplotlib seaborn numpy
Why: These libraries provide the tools we need to read, manipulate, and visualize our data. Pandas handles data structures, matplotlib creates plots, and seaborn provides enhanced visualization capabilities.
2. Create Sample Data
Let's create some sample data that represents a food delivery business like Just Eat Takeaway. Create a new Python file called delivery_analysis.py and add this code:
import pandas as pd
import numpy as np
# Create sample delivery data
np.random.seed(42)
data = {
'date': pd.date_range('2023-01-01', periods=365, freq='D'),
'daily_orders': np.random.randint(1000, 5000, 365),
'avg_order_value': np.random.uniform(15, 40, 365),
'delivery_fee': np.random.uniform(2, 8, 365),
'revenue': None
}
df = pd.DataFrame(data)
df['revenue'] = df['daily_orders'] * df['avg_order_value']
df.to_csv('delivery_data.csv', index=False)
print('Sample data created successfully!')
Why: This creates a realistic dataset simulating daily operations of a food delivery business. The data includes orders, order values, delivery fees, and calculated revenue - all key metrics that investors would analyze.
3. Load and Explore the Data
Now let's load the data and explore its structure:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Load the data
df = pd.read_csv('delivery_data.csv')
# Display basic information about the dataset
print('Dataset Info:')
print(df.info())
print('\nFirst 5 rows:')
print(df.head())
print('\nDataset statistics:')
print(df.describe())
Why: Understanding your data is crucial before analysis. The info() method shows data types, head() displays sample rows, and describe() gives statistical summaries of numerical columns.
4. Calculate Key Business Metrics
Let's calculate some important metrics that investors like Prosus would care about:
# Calculate key business metrics
annual_revenue = df['revenue'].sum()
monthly_avg_orders = df.groupby(df['date'].dt.month)['daily_orders'].mean()
monthly_avg_revenue = df.groupby(df['date'].dt.month)['revenue'].mean()
print(f'Total Annual Revenue: €{annual_revenue:,.2f}')
print(f'Average Monthly Orders: {monthly_avg_orders.mean():,.0f}')
print(f'Average Monthly Revenue: €{monthly_avg_revenue.mean():,.2f}')
# Calculate growth metrics
latest_month = df[df['date'] > '2023-11-01']['revenue'].sum()
previous_month = df[df['date'] < '2023-11-01']['revenue'].sum()
growth_rate = ((latest_month - previous_month) / previous_month) * 100
print(f'Month-over-Month Growth Rate: {growth_rate:.2f}%')
Why: These calculations mirror what Prosus would analyze when evaluating their investment. Revenue, order volume, and growth rates are key indicators of business performance.
5. Create Visualizations
Now let's create visualizations to better understand the data:
# Set up the plotting style
plt.style.use('seaborn-v0_8')
fig, axes = plt.subplots(2, 2, figsize=(15, 10))
fig.suptitle('Food Delivery Business Analysis Dashboard', fontsize=16)
# Plot 1: Daily Revenue Trend
axes[0, 0].plot(df['date'], df['revenue'], color='blue')
axes[0, 0].set_title('Daily Revenue Trend')
axes[0, 0].set_ylabel('Revenue (€)')
axes[0, 0].tick_params(axis='x', rotation=45)
# Plot 2: Orders vs Revenue
axes[0, 1].scatter(df['daily_orders'], df['revenue'], alpha=0.6, color='green')
axes[0, 1].set_title('Orders vs Revenue')
axes[0, 1].set_xlabel('Daily Orders')
axes[0, 1].set_ylabel('Revenue (€)')
# Plot 3: Monthly Average Revenue
monthly_revenue = df.groupby(df['date'].dt.month)['revenue'].mean()
axes[1, 0].bar(monthly_revenue.index, monthly_revenue.values, color='orange')
axes[1, 0].set_title('Average Monthly Revenue')
axes[1, 0].set_xlabel('Month')
axes[1, 0].set_ylabel('Average Revenue (€)')
# Plot 4: Order Value Distribution
axes[1, 1].hist(df['avg_order_value'], bins=30, color='purple', alpha=0.7)
axes[1, 1].set_title('Distribution of Order Values')
axes[1, 1].set_xlabel('Order Value (€)')
axes[1, 1].set_ylabel('Frequency')
plt.tight_layout()
plt.savefig('delivery_dashboard.png', dpi=300, bbox_inches='tight')
plt.show()
Why: Visualizations help identify patterns and trends that might not be obvious from raw numbers. The dashboard shows revenue trends, correlation between orders and revenue, monthly performance, and distribution of order values.
6. Export Analysis Results
Finally, let's save our analysis results for reporting:
# Create summary report
summary = {
'total_annual_revenue': annual_revenue,
'average_monthly_orders': monthly_avg_orders.mean(),
'average_monthly_revenue': monthly_avg_revenue.mean(),
'growth_rate': growth_rate
}
# Save to CSV for further analysis
summary_df = pd.DataFrame([summary])
summary_df.to_csv('business_summary.csv', index=False)
print('Analysis summary saved to business_summary.csv')
Why: Saving your results allows you to share findings with stakeholders and use the data for future analysis. This format is easily readable by business users and can be imported into spreadsheets or reporting tools.
Summary
In this tutorial, you've learned how to analyze food delivery business data using Python. You created sample data representing a delivery service, calculated key business metrics like revenue and growth rates, and visualized the data using matplotlib and seaborn. This approach mirrors what investors like Prosus would use to evaluate their investments in companies like Just Eat Takeaway.
The skills you've learned include data loading, basic analysis, visualization creation, and result export - all essential for business intelligence and investment analysis. You can extend this framework to include more complex metrics, real-time data sources, or integration with business dashboards.



