Skip to content

aniket3096/Supply_chain-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Supply_chain-analysis

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.

Supply Chain Analysis using Python

  • 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, and seaborn
  • 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

Prerequisites

PyPI

using pip, you can install NumPy,Pandas,matplotlib,seaborn with:

pip install numpy
pip install pandas
pip install matplotlib
pip install seaborn

SUMMARY

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())

1

2. Let’s have a look at the descriptive statistics of the dataset

print(data.describe())

2

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()

3

Thus, the company derives more revenue from skincare products, and the higher the price of skincare products, the more revenue they generate

4.Now let’s have a look at the sales by product type

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()

4

So 45% of the business comes from skincare products, 29.5% from haircare, and 25.5% from cosmetics

5.let’s have a look at the total revenue generated from shipping carriers

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()

5

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)

6

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.

7. let’s analyze the revenue generated by each SKU

revenue_chart = px.line(data, x='SKU', 
                        y='Revenue generated', 
                        title='Revenue Generated by SKU')
revenue_chart.show()

7

8. let’s analyze the revenue generated by each SKU

stock_chart = px.line(data, x='SKU', 
                     y='Stock levels', 
                     title='Stock Levels by SKU')
stock_chart.show()

8

9. let’s have a look at the order quantity of each SKU

order_quantity_chart = px.bar(data, x='SKU', 
                             y='Order quantities', 
                             title='Order Quantity by SKU')
order_quantity_chart.show()

9

Cost Analysis

10. let’s analyze the shipping cost of Carriers

shipping_cost_chart = px.bar(data, x='Shipping carriers', 
                            y='Shipping costs', 
                            title='Shipping Costs by Carrier')
shipping_cost_chart.show()

10

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.

11. let’s have a look at the cost distribution by transportation mode

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()

11

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.

12. Let’s have a look at the average defect rate of all product types

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()

12

So the defect rate of haircare products is high.

13. let’s have a look at the defect rates by mode of transportation

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()

13

Road transportation results in a higher defect rate, and Air transportation has the lowest defect rate.

Conclusion

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.