The supply Chain is the network of production and logistics involved in producing and delivering goods to customers. And Supply Chain Analysis means analyzing various components of a Supply Chain to understand how to improve the effectiveness of the Supply Chain to create more value for customers.
- Understand how data analysts and scientists gather and analyze data
- Perform data analysis in Python
- Combine, group, and aggregate data from multiple sources
- Create data visualizations with
pandas
,matplotlib
, andseaborn
- Use Python data science libraries to analyze real-world datasets.
- Use
pandas
to solve several common data representation and analysis problems - Utilize computer science concepts and algorithms to write more efficient code for data analysis
- Write and run simulations
using pip, you can install NumPy
,Pandas
,matplotlib
,seaborn
with:
pip install numpy
pip install pandas
pip install matplotlib
pip install seaborn
To analyze a company’s supply chain, we need data on the different stages of the supply chain, like data about sourcing, manufacturing, transportation, inventory management, sales and customer demographics.
1. Let’s get started with the task of Supply Chain Analysis by importing the necessary Python libraries and the dataset
import pandas as pd
import plotly.express as px
import plotly.io as pio
import plotly.graph_objects as go
pio.templates.default = "plotly_white"
data = pd.read_csv("supply_chain_data.csv")
print(data.head())
print(data.describe())
3. let’s get started with analyzing the Supply Chain by looking at the relationship between the price of the products and the revenue generated by them
fig = px.scatter(data, x='Price',
y='Revenue generated',
color='Product type',
hover_data=['Number of products sold'],
trendline="ols")
fig.show()
Thus, the company derives more revenue from skincare products, and the higher the price of skincare products, the more revenue they generate
sales_data = data.groupby('Product type')['Number of products sold'].sum().reset_index()
pie_chart = px.pie(sales_data, values='Number of products sold', names='Product type',
title='Sales by Product Type',
hover_data=['Number of products sold'],
hole=0.5,
color_discrete_sequence=px.colors.qualitative.Pastel)
pie_chart.update_traces(textposition='inside', textinfo='percent+label')
pie_chart.show()
total_revenue = data.groupby('Shipping carriers')['Revenue generated'].sum().reset_index()
fig = go.Figure()
fig.add_trace(go.Bar(x=total_revenue['Shipping carriers'],
y=total_revenue['Revenue generated']))
fig.update_layout(title='Total Revenue by Shipping Carrier',
xaxis_title='Shipping Carrier',
yaxis_title='Revenue Generated')
fig.show()
So the company is using three carriers for transportation, and Carrier B helps the company in generating more revenue.
6. let’s have a look at the Average lead time and Average Manufacturing Costs for all products of the company
avg_lead_time = data.groupby('Product type')['Lead time'].mean().reset_index()
avg_manufacturing_costs = data.groupby('Product type')['Manufacturing costs'].mean().reset_index()
result = pd.merge(avg_lead_time, avg_manufacturing_costs, on='Product type')
result.rename(columns={'Lead time': 'Average Lead Time', 'Manufacturing costs': 'Average Manufacturing Costs'}, inplace=True)
print(result)
Analyzing SKUs
SKU stands for Stock Keeping Units. They’re like special codes that help companies keep track of all the different things they have for sale. You give each toy a unique code, like a secret number only the store knows. This secret number is called SKU.
revenue_chart = px.line(data, x='SKU',
y='Revenue generated',
title='Revenue Generated by SKU')
revenue_chart.show()
stock_chart = px.line(data, x='SKU',
y='Stock levels',
title='Stock Levels by SKU')
stock_chart.show()
order_quantity_chart = px.bar(data, x='SKU',
y='Order quantities',
title='Order Quantity by SKU')
order_quantity_chart.show()
Cost Analysis
shipping_cost_chart = px.bar(data, x='Shipping carriers',
y='Shipping costs',
title='Shipping Costs by Carrier')
shipping_cost_chart.show()
In the above visualizations, we discovered that Carrier B helps the company in more revenue. It is also the most costly Carrier among the three.
transportation_chart = px.pie(data,
values='Costs',
names='Transportation modes',
title='Cost Distribution by Transportation Mode',
hole=0.5,
color_discrete_sequence=px.colors.qualitative.Pastel)
transportation_chart.show()
So the company spends more on Road and Rail modes of transportation for the transportation of Goods.
Analyzing Defect Rate
The defect rate in the supply chain refers to the percentage of products that have something wrong or are found broken after shipping.
defect_rates_by_product = data.groupby('Product type')['Defect rates'].mean().reset_index()
fig = px.bar(defect_rates_by_product, x='Product type', y='Defect rates',
title='Average Defect Rates by Product Type')
fig.show()
pivot_table = pd.pivot_table(data, values='Defect rates',
index=['Transportation modes'],
aggfunc='mean')
transportation_chart = px.pie(values=pivot_table["Defect rates"],
names=pivot_table.index,
title='Defect Rates by Transportation Mode',
hole=0.5,
color_discrete_sequence=px.colors.qualitative.Pastel)
transportation_chart.show()
Road transportation results in a higher defect rate, and Air transportation has the lowest defect rate.
Conclusion