{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import networkx as nx\n", "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "from mpl_toolkits.basemap import Basemap as Basemap\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Below are calculations for edge and node weights using financial data from the Bloomberg Terminal and FactSet. Edges are calculated as the product of Inventory Turnover * Node Weight * Percent Revenue. \n", "Node Weight for CLF, AKS, X, and MT are assumed to be 1\n", "Downstream node weight is calculated as the sum of the supplier edges connecting each customer in the supply chain. " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Supplier5 year Average Inventory Turnover RatioCustomerPercent RevenueValue (M)#connectionsWeighted Turnover2017 Inventory Turnover Ratio
0AK Steel5.26Ford Motor Co0.1200$705.90230.6312004.96
1AK Steel5.26Fiat Chrysler0.1100$647.08230.5786004.96
2AK Steel5.26General Motors Co0.0985$144.90230.5181104.96
3AK Steel5.26Toyota Motors0.0632$92.91230.3324324.96
4AK Steel5.26Honda Motor Co0.0366$53.86230.1925164.96
\n", "
" ], "text/plain": [ " Supplier 5 year Average Inventory Turnover Ratio Customer \\\n", "0 AK Steel 5.26 Ford Motor Co \n", "1 AK Steel 5.26 Fiat Chrysler \n", "2 AK Steel 5.26 General Motors Co \n", "3 AK Steel 5.26 Toyota Motors \n", "4 AK Steel 5.26 Honda Motor Co \n", "\n", " Percent Revenue Value (M) #connections Weighted Turnover \\\n", "0 0.1200 $705.90 23 0.631200 \n", "1 0.1100 $647.08 23 0.578600 \n", "2 0.0985 $144.90 23 0.518110 \n", "3 0.0632 $92.91 23 0.332432 \n", "4 0.0366 $53.86 23 0.192516 \n", "\n", " 2017 Inventory Turnover Ratio \n", "0 4.96 \n", "1 4.96 \n", "2 4.96 \n", "3 4.96 \n", "4 4.96 " ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#nodes, test sheet\n", "SPLC = pd.read_csv('SPLC_data.csv')#, index_col='Supplier')\n", "SPLC.head()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
index5 year Average Inventory Turnover RatioCustomerPercent RevenueValue (M)#connectionsWeighted Turnover2017 Inventory Turnover RatioNode Weight
Supplier
AK Steel05.26Ford Motor Co0.1200$705.90230.6312004.961.0
AK Steel15.26Fiat Chrysler0.1100$647.08230.5786004.961.0
AK Steel25.26General Motors Co0.0985$144.90230.5181104.961.0
AK Steel35.26Toyota Motors0.0632$92.91230.3324324.961.0
AK Steel45.26Honda Motor Co0.0366$53.86230.1925164.961.0
\n", "
" ], "text/plain": [ " index 5 year Average Inventory Turnover Ratio Customer \\\n", "Supplier \n", "AK Steel 0 5.26 Ford Motor Co \n", "AK Steel 1 5.26 Fiat Chrysler \n", "AK Steel 2 5.26 General Motors Co \n", "AK Steel 3 5.26 Toyota Motors \n", "AK Steel 4 5.26 Honda Motor Co \n", "\n", " Percent Revenue Value (M) #connections Weighted Turnover \\\n", "Supplier \n", "AK Steel 0.1200 $705.90 23 0.631200 \n", "AK Steel 0.1100 $647.08 23 0.578600 \n", "AK Steel 0.0985 $144.90 23 0.518110 \n", "AK Steel 0.0632 $92.91 23 0.332432 \n", "AK Steel 0.0366 $53.86 23 0.192516 \n", "\n", " 2017 Inventory Turnover Ratio Node Weight \n", "Supplier \n", "AK Steel 4.96 1.0 \n", "AK Steel 4.96 1.0 \n", "AK Steel 4.96 1.0 \n", "AK Steel 4.96 1.0 \n", "AK Steel 4.96 1.0 " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Sets initial node weights for CLF, AKS, X, MT to 1 and SUN to 0.5\n", "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Supplier')\n", "SPLC.loc['Cleveland Cliffs','Node Weight']=1\n", "SPLC.loc['AK Steel','Node Weight']=1\n", "SPLC.loc['ArcelorMittal','Node Weight']=1\n", "SPLC.loc['US Steel','Node Weight']=1\n", "SPLC.loc['Suncoke Energy','Node Weight']=0.5\n", "SPLC.loc['Suncoke Energy Partners','Node Weight']=0.5\n", "SPLC.head()" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
index5 year Average Inventory Turnover RatioCustomerPercent RevenueValue (M)#connectionsWeighted Turnover2017 Inventory Turnover RatioNode WeightEdge Weight
Supplier
AK Steel05.26Ford Motor Co0.1200$705.90230.6312004.961.00.631200
AK Steel15.26Fiat Chrysler0.1100$647.08230.5786004.961.00.578600
AK Steel25.26General Motors Co0.0985$144.90230.5181104.961.00.518110
AK Steel35.26Toyota Motors0.0632$92.91230.3324324.961.00.332432
AK Steel45.26Honda Motor Co0.0366$53.86230.1925164.961.00.192516
\n", "
" ], "text/plain": [ " index 5 year Average Inventory Turnover Ratio Customer \\\n", "Supplier \n", "AK Steel 0 5.26 Ford Motor Co \n", "AK Steel 1 5.26 Fiat Chrysler \n", "AK Steel 2 5.26 General Motors Co \n", "AK Steel 3 5.26 Toyota Motors \n", "AK Steel 4 5.26 Honda Motor Co \n", "\n", " Percent Revenue Value (M) #connections Weighted Turnover \\\n", "Supplier \n", "AK Steel 0.1200 $705.90 23 0.631200 \n", "AK Steel 0.1100 $647.08 23 0.578600 \n", "AK Steel 0.0985 $144.90 23 0.518110 \n", "AK Steel 0.0632 $92.91 23 0.332432 \n", "AK Steel 0.0366 $53.86 23 0.192516 \n", "\n", " 2017 Inventory Turnover Ratio Node Weight Edge Weight \n", "Supplier \n", "AK Steel 4.96 1.0 0.631200 \n", "AK Steel 4.96 1.0 0.578600 \n", "AK Steel 4.96 1.0 0.518110 \n", "AK Steel 4.96 1.0 0.332432 \n", "AK Steel 4.96 1.0 0.192516 " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates Edge Weight as the Product of Inventory Turnover * Node Weight * Percent Revenue\n", "SPLC['Edge Weight']=SPLC['5 year Average Inventory Turnover Ratio']*SPLC['Node Weight']*SPLC['Percent Revenue']\n", "SPLC.head()" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "#Assigns Customer Column as index column\n", "SPLC = SPLC.reset_index()\n", "SPLC = SPLC.set_index('Customer')" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "#Calculates Node Weight for Koppers Holdings and Shiloh Industries\n", "#SPLC.loc['Koppers Holdings Inc']\n", "Kop=SPLC.loc['Koppers Holdings Inc','Edge Weight'].sum()\n", "Shiloh=SPLC.loc['Shiloh Industries','Edge Weight'].sum()\n" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Customerindex5 year Average Inventory Turnover RatioPercent RevenueValue (M)#connectionsWeighted Turnover2017 Inventory Turnover RatioNode WeightEdge Weight
Supplier
Koppers Holdings IncCSX Corp2166.070.0610$21.9530.3702705.210.0028190.001044
Koppers Holdings IncBerkshire Hathaway (BNSF)2176.070.0604$20.2230.3666285.210.0028190.001034
Koppers Holdings IncCanadian National Railway Co2186.070.0445$15.4530.2701155.210.0028190.000761
\n", "
" ], "text/plain": [ " Customer index \\\n", "Supplier \n", "Koppers Holdings Inc CSX Corp 216 \n", "Koppers Holdings Inc Berkshire Hathaway (BNSF) 217 \n", "Koppers Holdings Inc Canadian National Railway Co 218 \n", "\n", " 5 year Average Inventory Turnover Ratio \\\n", "Supplier \n", "Koppers Holdings Inc 6.07 \n", "Koppers Holdings Inc 6.07 \n", "Koppers Holdings Inc 6.07 \n", "\n", " Percent Revenue Value (M) #connections \\\n", "Supplier \n", "Koppers Holdings Inc 0.0610 $21.95 3 \n", "Koppers Holdings Inc 0.0604 $20.22 3 \n", "Koppers Holdings Inc 0.0445 $15.45 3 \n", "\n", " Weighted Turnover 2017 Inventory Turnover Ratio \\\n", "Supplier \n", "Koppers Holdings Inc 0.370270 5.21 \n", "Koppers Holdings Inc 0.366628 5.21 \n", "Koppers Holdings Inc 0.270115 5.21 \n", "\n", " Node Weight Edge Weight \n", "Supplier \n", "Koppers Holdings Inc 0.002819 0.001044 \n", "Koppers Holdings Inc 0.002819 0.001034 \n", "Koppers Holdings Inc 0.002819 0.000761 " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Recalculates Edge Weights with newly calculated node weights\n", "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Supplier')\n", "SPLC.loc['Shiloh Industries','Node Weight']=Shiloh\n", "SPLC.loc['Koppers Holdings Inc','Node Weight']=Kop\n", "SPLC['Edge Weight']=SPLC['5 year Average Inventory Turnover Ratio']*SPLC['Node Weight']*SPLC['Percent Revenue']\n", "SPLC.loc['Koppers Holdings Inc']" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "#Calculates Node Weight for Faurecia\n", "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Customer')\n", "SPLC.loc['Faurecia']\n", "Faurecia=SPLC.loc['Faurecia','Edge Weight'].sum()\n", "Gestamp=SPLC.loc['Gestamp Automocion','Edge Weight'].sum()\n", "Caterpillar=SPLC.loc['Caterpillar','Edge Weight'].sum()\n", "Friedman=SPLC.loc['Friedman Industries','Edge Weight'].sum()\n" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.182792" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#This calculates an intermediate weight for Nucor. There is a feedback loop between Nucor, Steel Dynamics, and Reliance Steel & Aluminimum\n", "SPLC.loc['Nucor']\n", "Nucor=SPLC.loc['Nucor','Edge Weight'].sum()\n", "Nucor" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Supplierindex5 year Average Inventory Turnover RatioPercent RevenueValue (M)#connectionsWeighted Turnover2017 Inventory Turnover RatioNode WeightEdge Weight
Customer
Ford Motor CoAK Steel05.260.1200$705.90230.6312004.961.00.631200
Fiat ChryslerAK Steel15.260.1100$647.08230.5786004.961.00.578600
General Motors CoAK Steel25.260.0985$144.90230.5181104.961.00.518110
Toyota MotorsAK Steel35.260.0632$92.91230.3324324.961.00.332432
Honda Motor CoAK Steel45.260.0366$53.86230.1925164.961.00.192516
\n", "
" ], "text/plain": [ " Supplier index 5 year Average Inventory Turnover Ratio \\\n", "Customer \n", "Ford Motor Co AK Steel 0 5.26 \n", "Fiat Chrysler AK Steel 1 5.26 \n", "General Motors Co AK Steel 2 5.26 \n", "Toyota Motors AK Steel 3 5.26 \n", "Honda Motor Co AK Steel 4 5.26 \n", "\n", " Percent Revenue Value (M) #connections \\\n", "Customer \n", "Ford Motor Co 0.1200 $705.90 23 \n", "Fiat Chrysler 0.1100 $647.08 23 \n", "General Motors Co 0.0985 $144.90 23 \n", "Toyota Motors 0.0632 $92.91 23 \n", "Honda Motor Co 0.0366 $53.86 23 \n", "\n", " Weighted Turnover 2017 Inventory Turnover Ratio \\\n", "Customer \n", "Ford Motor Co 0.631200 4.96 \n", "Fiat Chrysler 0.578600 4.96 \n", "General Motors Co 0.518110 4.96 \n", "Toyota Motors 0.332432 4.96 \n", "Honda Motor Co 0.192516 4.96 \n", "\n", " Node Weight Edge Weight \n", "Customer \n", "Ford Motor Co 1.0 0.631200 \n", "Fiat Chrysler 1.0 0.578600 \n", "General Motors Co 1.0 0.518110 \n", "Toyota Motors 1.0 0.332432 \n", "Honda Motor Co 1.0 0.192516 " ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "SPLC.head()" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "#Recalculates Edge Weights with newly calculated node weights\n", "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Supplier')\n", "SPLC.loc['Nucor','Node Weight']=Nucor\n", "SPLC.loc['Faurecia','Node Weight']=Faurecia\n", "SPLC.loc['Gestamp Automocion','Node Weight']=Gestamp\n", "SPLC.loc['Friedman Industries','Node Weight']=Friedman\n", "SPLC['Edge Weight']=SPLC['5 year Average Inventory Turnover Ratio']*SPLC['Node Weight']*SPLC['Percent Revenue']\n", "#SPLC" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.10385162792000001" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Customer')\n", "SPLC.loc['Steel Dynamics']\n", "StlDyn=SPLC.loc['Steel Dynamics','Edge Weight'].sum()\n", "StlDyn" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "#Recalculates Edge Weights with newly calculated node weights\n", "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Supplier')\n", "SPLC.loc['Steel Dynamics','Node Weight']=StlDyn\n", "#SPLC.loc['Faurecia','Node Weight']=Faurecia\n", "SPLC['Edge Weight']=SPLC['5 year Average Inventory Turnover Ratio']*SPLC['Node Weight']*SPLC['Percent Revenue']" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.0036282427424171202" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Customer')\n", "CSX=SPLC.loc['CSX Corp','Edge Weight'].sum()\n", "CSX" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [], "source": [ "#Recalculates Edge Weights with newly calculated node weights\n", "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Supplier')\n", "SPLC.loc['CSX Corp','Node Weight']=CSX\n", "#SPLC.loc['Faurecia','Node Weight']=Faurecia\n", "SPLC['Edge Weight']=SPLC['5 year Average Inventory Turnover Ratio']*SPLC['Node Weight']*SPLC['Percent Revenue']" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Supplierindex5 year Average Inventory Turnover RatioPercent RevenueValue (M)#connectionsWeighted Turnover2017 Inventory Turnover RatioNode WeightEdge Weight
Customer
NucorCleveland Cliffs1405.840.0313$21.87100.1827926.681.0000000.182792
NucorCSX Corp14624.620.0295$79.99100.72629019.350.0036280.002635
\n", "
" ], "text/plain": [ " Supplier index 5 year Average Inventory Turnover Ratio \\\n", "Customer \n", "Nucor Cleveland Cliffs 140 5.84 \n", "Nucor CSX Corp 146 24.62 \n", "\n", " Percent Revenue Value (M) #connections Weighted Turnover \\\n", "Customer \n", "Nucor 0.0313 $21.87 10 0.182792 \n", "Nucor 0.0295 $79.99 10 0.726290 \n", "\n", " 2017 Inventory Turnover Ratio Node Weight Edge Weight \n", "Customer \n", "Nucor 6.68 1.000000 0.182792 \n", "Nucor 19.35 0.003628 0.002635 " ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Customer')\n", "Nucor=SPLC.loc['Nucor','Edge Weight'].sum()\n", "SPLC.loc['Nucor']" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [], "source": [ "#Recalculates Edge Weights with newly calculated node weights\n", "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Supplier')\n", "SPLC.loc['Nucor','Node Weight']=Nucor\n", "SPLC['Edge Weight']=SPLC['5 year Average Inventory Turnover Ratio']*SPLC['Node Weight']*SPLC['Percent Revenue']\n", "#SPLC.loc['Nucor']" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.10391753318209898" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Customer')\n", "SPLC.loc['Steel Dynamics']\n", "StlDyn=SPLC.loc['Steel Dynamics','Edge Weight'].sum()\n", "StlDyn" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [], "source": [ "#Calculates Node Size for Worthington Industries and Union Pacific\n", "SPLC.loc['Worthington Industries']\n", "Worth=SPLC.loc['Worthington Industries','Edge Weight'].sum()\n", "Union=SPLC.loc['Union Pacific','Edge Weight'].sum()\n", "Atkore=SPLC.loc['Atkore International','Edge Weight'].sum()\n" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [], "source": [ "#Recalculates Edge Weights with newly calculated node weights\n", "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Supplier')\n", "SPLC.loc['Worthington Industries','Node Weight']=Worth\n", "SPLC.loc['Union Pacific','Node Weight']=Union\n", "SPLC.loc['Atkore International','Node Weight']=Atkore\n", "SPLC['Edge Weight']=SPLC['5 year Average Inventory Turnover Ratio']*SPLC['Node Weight']*SPLC['Percent Revenue']\n" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [], "source": [ "#calculate Node Weight for Reliance Steel & Aluminum\n", "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Customer')\n", "Rel=SPLC.loc['Reliance Steel & Aluminum','Edge Weight'].sum()" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [], "source": [ "#Recalculates Edge Weights with newly calculated node weights\n", "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Supplier')\n", "SPLC.loc['Reliance Steel & Aluminum','Node Weight']=Rel\n", "#SPLC.loc['Union Pacific','Node Weight']=Union\n", "SPLC['Edge Weight']=SPLC['5 year Average Inventory Turnover Ratio']*SPLC['Node Weight']*SPLC['Percent Revenue']\n" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.039763963481430076" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Customer')\n", "Ten=SPLC.loc['Tenneco Inc','Edge Weight'].sum()\n", "Ten" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [], "source": [ "#Recalculates Edge Weights with newly calculated node weights\n", "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Supplier')\n", "SPLC.loc['Tenneco Inc','Node Weight']=Ten\n", "SPLC['Edge Weight']=SPLC['5 year Average Inventory Turnover Ratio']*SPLC['Node Weight']*SPLC['Percent Revenue']\n", "\n" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1.1973681496240502" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "SPLC=SPLC.reset_index()\n", "SPLC=SPLC.set_index('Customer')\n", "#Calculates node weight for GM with 11 in-degree edges\n", "GM=SPLC.loc['General Motors Co','Edge Weight'].sum()\n", "GM\n", "#SPLC.loc['General Motors Co']" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1.0110018947001709" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for Ford with 10 in-degree edges\n", "Ford=SPLC.loc['Ford Motor Co','Edge Weight'].sum()\n", "Ford\n", "#SPLC.loc['Ford Motor Co']" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.7808928128493202" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for Fiat Chrysler with 8 in-degree edges\n", "Fiat=SPLC.loc['Fiat Chrysler','Edge Weight'].sum()\n", "Fiat\n", "#SPLC.loc['Fiat Chrysler']" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.6489270164144629" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for Volkswagen with 10 in-degree edges\n", "VW=SPLC.loc['Volkswagen','Edge Weight'].sum()\n", "VW\n", "#SPLC.loc['Volkswagen']" ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.4259901227339424" ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for Daimler with 7 in-degree edges\n", "Daimler=SPLC.loc['Daimler AG','Edge Weight'].sum()\n", "Daimler\n", "#SPLC.loc['Daimler AG']" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.4001946770418564" ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for Toyota with 8 in-degree edges\n", "Toyota=SPLC.loc['Toyota Motors','Edge Weight'].sum()\n", "Toyota\n", "#SPLC.loc['Toyota Motors']" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.2410820956217228" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for Honda with 9 in-degree edges\n", "Honda=SPLC.loc['Honda Motor Co','Edge Weight'].sum()\n", "Honda\n", "#SPLC.loc['Honda Motor Co']" ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.196747907218708" ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for BMW with 7 in-degree edges\n", "BMW=SPLC.loc['Bayerische Motorenwerks','Edge Weight'].sum()\n", "BMW\n", "#SPLC.loc['Bayerische Motorenwerks']" ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.14376938364050218" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for Hyundai with 8 in-degree edges\n", "Hyundai=SPLC.loc['Hyundai Motor Corp','Edge Weight'].sum()\n", "Hyundai\n", "#SPLC.loc['Hyundai Motor Corp']" ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.0858189071206128" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for Kia with 5 in-degree edges\n", "Kia=SPLC.loc['Kia Motors Corp','Edge Weight'].sum()\n", "Kia\n", "#SPLC.loc['Kia Motors Corp']" ] }, { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.006002081369729405" ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for Isuzu with 4 in-degree edges\n", "Isuzu=SPLC.loc['Isuzu Motors','Edge Weight'].sum()\n", "Isuzu\n", "#SPLC.loc['Isuzu Motors']" ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.04717847847666626" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for Tata with 5 in-degree edges\n", "Tata=SPLC.loc['Tata Motor Corp','Edge Weight'].sum()\n", "Tata\n", "#SPLC.loc['Tata Motor Corp']" ] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.18542715642139013" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Nucor\n", "#SPLC.loc['Nucor']" ] }, { "cell_type": "code", "execution_count": 38, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.15969683449016447" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Rel\n", "#SPLC.loc['Reliance Steel & Aluminum']" ] }, { "cell_type": "code", "execution_count": 39, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.10391753318209898" ] }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "StlDyn\n", "#SPLC.loc['Steel Dynamics']" ] }, { "cell_type": "code", "execution_count": 40, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.09866383167551765" ] }, "execution_count": 40, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Worth\n", "#SPLC.loc['Worthington Industries']" ] }, { "cell_type": "code", "execution_count": 41, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.078722470166" ] }, "execution_count": 41, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Faurecia\n", "#SPLC.loc['Faurecia']" ] }, { "cell_type": "code", "execution_count": 42, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.04502792962416832" ] }, "execution_count": 42, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for Magna with 3 in-degree edges\n", "Magna=SPLC.loc['Magna International Inc','Edge Weight'].sum()\n", "Magna\n", "#SPLC.loc['Magna International Inc']" ] }, { "cell_type": "code", "execution_count": 43, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.039763963481430076" ] }, "execution_count": 43, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Ten \n", "#SPLC.loc['Tenneco Inc']" ] }, { "cell_type": "code", "execution_count": 44, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.0009110928397990283" ] }, "execution_count": 44, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for Ford with 3 in-degree edges\n", "Axle=SPLC.loc['American Axle','Edge Weight'].sum()\n", "Axle\n", "#SPLC.loc['American Axle']" ] }, { "cell_type": "code", "execution_count": 45, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.010981" ] }, "execution_count": 45, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Shiloh\n", "#SPLC.loc['Shiloh Industries']" ] }, { "cell_type": "code", "execution_count": 46, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.21577536941430817" ] }, "execution_count": 46, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for Whirlpool with 4 in-degree edges\n", "Whirlpool=SPLC.loc['Whirlpool Corp','Edge Weight'].sum()\n", "Whirlpool\n", "#SPLC.loc['Whirlpool Corp']" ] }, { "cell_type": "code", "execution_count": 47, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.03959009649001224" ] }, "execution_count": 47, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for John Deere with 5 in-degree edges\n", "Deere=SPLC.loc['Deere & Co','Edge Weight'].sum()\n", "Deere\n", "#SPLC.loc['Deere & Co']" ] }, { "cell_type": "code", "execution_count": 48, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.029345166434820297" ] }, "execution_count": 48, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for General Electric with 3 in-degree edges\n", "GE=SPLC.loc['General Electric','Edge Weight'].sum()\n", "GE\n", "#SPLC.loc['General Electric']" ] }, { "cell_type": "code", "execution_count": 49, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.025812127737388915" ] }, "execution_count": 49, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#Calculates node weight for Electrolux with 3 in-degree edges\n", "Electrolux=SPLC.loc['Electrolux','Edge Weight'].sum()\n", "Electrolux\n", "#SPLC.loc['Electrolux']" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.6" } }, "nbformat": 4, "nbformat_minor": 2 }