Vertopal.com_Supply Chain Analytics
Vertopal.com_Supply Chain Analytics
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
pf=pd.read_csv('/content/drive/MyDrive/Colab
Notebooks/supply_chain_data.csv')
a=pf
a.describe()
a.shape
(100, 24)
a.isnull()
{"type":"dataframe"}
a.count()
a.head()
{"type":"dataframe","variable_name":"a"}
unique_products = a['Product type'].unique()
print(unique_products)
a.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 100 entries, 0 to 99
Data columns (total 24 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Product type 100 non-null object
1 SKU 100 non-null object
2 Price 100 non-null float64
3 Availability 100 non-null int64
4 Number of products sold 100 non-null int64
5 Revenue generated 100 non-null float64
6 Customer demographics 100 non-null object
7 Stock levels 100 non-null int64
8 Lead times 100 non-null int64
9 Order quantities 100 non-null int64
10 Shipping times 100 non-null int64
11 Shipping carriers 100 non-null object
12 Shipping costs 100 non-null float64
13 Supplier name 100 non-null object
14 Location 100 non-null object
15 Lead time 100 non-null int64
16 Production volumes 100 non-null int64
17 Manufacturing lead time 100 non-null int64
18 Manufacturing costs 100 non-null float64
19 Inspection results 100 non-null object
20 Defect rates 100 non-null float64
21 Transportation modes 100 non-null object
22 Routes 100 non-null object
23 Costs 100 non-null float64
dtypes: float64(6), int64(9), object(9)
memory usage: 18.9+ KB
a.isnull().sum()
Product type 0
SKU 0
Price 0
Availability 0
Number of products sold 0
Revenue generated 0
Customer demographics 0
Stock levels 0
Lead times 0
Order quantities 0
Shipping times 0
Shipping carriers 0
Shipping costs 0
Supplier name 0
Location 0
Lead time 0
Production volumes 0
Manufacturing lead time 0
Manufacturing costs 0
Inspection results 0
Defect rates 0
Transportation modes 0
Routes 0
Costs 0
dtype: int64
a.columns
a['Product type'].value_counts()
Product type
skincare 40
haircare 34
cosmetics 26
Name: count, dtype: int64
print(demographics.head(10).to_string(index=False))
Customer demographics
Non-binary
Female
Unknown
Non-binary
Non-binary
Non-binary
Male
Female
Female
Unknown
a.columns
Index(['Product type', 'SKU', 'Price', 'Availability',
'Number of products sold', 'Revenue generated', 'Customer
demographics',
'Stock levels', 'Lead times', 'Order quantities', 'Shipping
times',
'Shipping carriers', 'Shipping costs', 'Supplier name',
'Location',
'Lead time', 'Production volumes', 'Manufacturing lead time',
'Manufacturing costs', 'Inspection results', 'Defect rates',
'Transportation modes', 'Routes', 'Costs'],
dtype='object')
a.head()
{"type":"dataframe","variable_name":"a"}
Shipping carriers
Carrier B 43
Carrier C 29
Carrier A 28
Name: count, dtype: int64
print(shipping_carrier_counts.to_string())
Shipping carriers
Carrier B 43
Carrier C 29
Carrier A 28
Shipping carriers
Carrier A 142629.994607
Carrier B 250094.646988
Carrier C 184880.177143
sn
Supplier name
Supplier 1 27
Supplier 2 22
Supplier 5 18
Supplier 4 18
Supplier 3 15
Name: count, dtype: int64
plt.figure(figsize=(8, 4))
plt.pie(sn, labels=sn.index, autopct='%1.1f%%', startangle=90)
plt.title('Relative Use of Shipping Carriers')
plt.axis('equal')
plt.show()
supplier_revenue = a.groupby('Supplier name')['Revenue
generated'].sum()
print(supplier_revenue.to_string())
Supplier name
Supplier 1 157528.995039
Supplier 2 125467.418605
Supplier 3 97795.979638
Supplier 4 86468.961799
Supplier 5 110343.463656
plt.figure(figsize=(5, 5))
plt.pie(supplier_revenue, labels=supplier_revenue.index,
autopct='%1.1f%%', startangle=90, textprops={'fontsize': 8}) # Reduce
fontsize for labels
plt.title('Revenue Generated by Supplier')
plt.axis('equal')
plt.show()
Location= a['Location'].value_counts()
Location
Location
Kolkata 25
Mumbai 22
Chennai 20
Bangalore 18
Delhi 15
Name: count, dtype: int64
plt.figure(figsize=(8, 4))
plt.pie(Location, labels=Location.index, autopct='%1.1f%%',
startangle=90)
plt.title('Locations')
plt.axis('equal')
plt.show()
Location_revenue = a.groupby('Location')['Revenue generated'].sum()
print(Location_revenue.to_string())
Location
Bangalore 102601.723882
Chennai 119142.815748
Delhi 81027.701225
Kolkata 137077.551005
Mumbai 137755.026877
plt.figure(figsize=(5, 4))
plt.pie(Location_revenue, labels=Location_revenue.index,
autopct='%1.1f%%', startangle=90, textprops={'fontsize': 8}) # Reduce
fontsize for labels
plt.title('Revenue Generated by Location')
plt.axis('equal')
plt.show()
a.columns
Transportation_modes
Transportation modes
Road 29
Rail 28
Air 26
Sea 17
Name: count, dtype: int64
plt.figure(figsize=(8, 4))
plt.pie(Transportation_modes, labels=Transportation_modes.index,
autopct='%1.1f%%', startangle=90)
plt.title('Transportation modes')
plt.axis('equal')
plt.show()
Transportation modes
Air 155735.349650
Rail 164990.417667
Road 159315.232239
Sea 97563.819181
plt.figure(figsize=(5, 5))
plt.pie(Transportation_modes, labels=Transportation_modes.index,
autopct='%1.1f%%', startangle=90, textprops={'fontsize': 8}) # Reduce
fontsize for labels
plt.title('Revenue Generated by Transportation_modes')
plt.axis('equal')
plt.show()
SKU= a['SKU'].value_counts()
SKU
SKU
SKU0 1
SKU63 1
SKU73 1
SKU72 1
SKU71 1
..
SKU30 1
SKU29 1
SKU28 1
SKU27 1
SKU99 1
Name: count, Length: 100, dtype: int64
SKU
SKU0 8661.996792
SKU1 7460.900065
SKU10 2330.965802
SKU11 6099.944116
SKU12 2873.741446
SKU13 4052.738416
SKU14 8653.570926
SKU15 5442.086785
SKU16 6453.797968
SKU17 2629.396435
SKU18 9364.673505
SKU19 2553.495585
SKU2 9577.749626
SKU20 8128.027697
SKU21 7087.052696
SKU22 2390.807867
SKU23 8858.367571
SKU24 9049.077861
SKU25 2174.777054
SKU26 3716.493326
SKU27 2686.457224
SKU28 6117.324615
SKU29 8318.903195
SKU3 7766.836426
SKU30 2766.342367
SKU31 9655.135103
SKU32 9571.550487
SKU33 5149.998350
SKU34 9061.710896
SKU35 6541.329345
SKU36 7573.402458
SKU37 2438.339930
SKU38 9692.318040
SKU39 1912.465663
SKU4 2686.505152
SKU40 5724.959350
SKU41 5521.205259
SKU42 1839.609426
SKU43 5737.425599
SKU44 7152.286049
SKU45 5267.956808
SKU46 2556.767361
SKU47 7089.474250
SKU48 7397.071005
SKU49 8001.613207
SKU5 2828.348746
SKU50 5910.885390
SKU51 9866.465458
SKU52 9435.762609
SKU53 8232.334829
SKU54 6088.021480
SKU55 2925.675170
SKU56 4767.020484
SKU57 1605.866900
SKU58 2021.149810
SKU59 1061.618523
SKU6 7823.476560
SKU60 8864.084350
SKU61 6885.589351
SKU62 3899.746834
SKU63 4256.949141
SKU64 8458.730878
SKU65 8354.579686
SKU66 8367.721618
SKU67 9473.798033
SKU68 3550.218433
SKU69 1752.381087
SKU7 8496.103813
SKU70 7014.887987
SKU71 8180.337085
SKU72 2633.121981
SKU73 7910.886916
SKU74 5709.945296
SKU75 1889.073590
SKU76 5328.375984
SKU77 2483.760178
SKU78 1292.458418
SKU79 7888.723268
SKU8 7517.363211
SKU80 8651.672683
SKU81 4384.413400
SKU82 2943.381868
SKU83 2411.754632
SKU84 2048.290100
SKU85 8684.613059
SKU86 1229.591029
SKU87 5133.846701
SKU88 9444.742033
SKU89 5924.682567
SKU9 4971.145988
SKU90 9592.633570
SKU91 1935.206794
SKU92 2100.129755
SKU93 4531.402134
SKU94 7888.356547
SKU95 7386.363944
SKU96 7698.424766
SKU97 4370.916580
SKU98 8525.952560
SKU99 9185.185829
shipping_routes=a['Routes'].value_counts()
shipping_routes
Routes
Route A 43
Route B 37
Route C 20
Name: count, dtype: int64
plt.figure(figsize=(5, 5))
plt.pie(shipping_routes, labels=shipping_routes.index, autopct='%1.1f%
%', startangle=90)
plt.title('shipping_routes')
plt.axis('equal')
plt.show()
Routes
Route A 253198.852380
Route B 204484.007893
Route C 119921.958465
plt.figure(figsize=(5, 5))
plt.pie(shipping_routes, labels=shipping_routes.index, autopct='%1.1f%
%', startangle=90, textprops={'fontsize': 8}) # Reduce fontsize for
labels
plt.title('Revenue Generated by Routes')
plt.axis('equal')
plt.show()