{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Typical Use Cases of the Library\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## General usage\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Importing the library\n" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "from geopolrisk.assessment.main import (\n", " gprs_calc,\n", ") # This is a one stop function to calculate all the values of the GeoPolRisk method" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Prepare the lists\n" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "from geopolrisk.assessment.utils import (\n", " default_rmlist,\n", ") # This is a functions that returns the default list of metals that are available in the library database\n", "\n", "ListofMetals = default_rmlist()\n", "ListofAlternateMetals = [\n", " \"Aluminium\",\n", " \"Copper\",\n", " \"Nickel\",\n", " \"Tin\",\n", " \"Zinc\",\n", "] # If you want to use a different list of metals, you can specify them here (of course, they must be available in the library database)\n", "# Aluminium is an exception in the database, it refers to primary metal not raw material. The raw material is bauxite\n", "\n", "ListofCountries = [\n", " \"China\",\n", " \"Germany\",\n", " 842,\n", " 36,\n", "] # List of countries to be assessed, you can use the ISO 3166-1 numeric code & \"EU\" for European Union\n", "\n", "ListofYear = [\n", " 2022\n", "] # List of years to be assessed, you can only use the year as an integer" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### GeoPolRisk Calculation using main function\n" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Calculating the GeoPolRisk: 100%|██████████| 212/212 [00:08<00:00, 25.61it/s]\n" ] }, { "data": { "application/vnd.microsoft.datawrangler.viewer.v0+json": { "columns": [ { "name": "index", "rawType": "int64", "type": "integer" }, { "name": "DBID", "rawType": "object", "type": "string" }, { "name": "Country [Economic Entity]", "rawType": "object", "type": "string" }, { "name": "Raw Material", "rawType": "object", "type": "string" }, { "name": "Year", "rawType": "int64", "type": "integer" }, { "name": "GeoPolRisk Score", "rawType": "float64", "type": "float" }, { "name": "GeoPolRisk Characterization Factor [eq. Kg-Cu/Kg]", "rawType": "float64", "type": "float" }, { "name": "HHI", "rawType": "float64", "type": "float" }, { "name": "Import Risk", "rawType": "float64", "type": "float" }, { "name": "Price", "rawType": "float64", "type": "float" } ], "ref": "79ee19cc-74ca-48a3-9522-8a7a6a9ad884", "rows": [ [ "0", "Aluminium1562022", "China", "Aluminium", "2022", "0.003944874781380299", "0.024356630597795206", "0.3532792047080751", "0.01116645058301709", "2.5278165947009335" ], [ "1", "Antimony1562022", "China", "Antimony", "2022", "0.07612793030702521", "0.7224165698472998", "0.276644236014858", "0.27518350428575905", "3.885127263441932" ], [ "2", "Arsenic1562022", "China", "Arsenic", "2022", "0.00015216057049886314", "0.07535318712565135", "0.3932371143058169", "0.0003869435639804061", "202.75009735547138" ], [ "3", "Asbestos1562022", "China", "Asbestos", "2022", "0.10858757648585425", "0.08165503151025084", "0.3349175309162646", "0.32422183511499464", "0.30786788186583863" ], [ "4", "Baryte1562022", "China", "Baryte", "2022", "0.00198077569788993", "0.0005360552511472624", "0.1513743257945944", "0.013085281717969268", "0.11079899702771734" ], [ "5", "Bauxite1562022", "China", "Bauxite", "2022", "0.06445723991862984", "0.008673293782450617", "0.18342379925561927", "0.3514115408153894", "0.055090146286528426" ], [ "6", "Bentonite1562022", "China", "Bentonite", "2022", "0.0059247540216603185", "0.0026010994629484165", "0.1313612728768959", "0.0451027452148142", "0.17974143656828134" ], [ "7", "Beryllium1562022", "China", "Beryllium", "2022", "0.06654457957773253", "5.470628901543", "0.4852018684461631", "0.13714823438507878", "33.65783239156861" ], [ "8", "Bismuth1562022", "China", "Bismuth", "2022", "0.0329879075133884", "0.8241822435476476", "0.5711330304233744", "0.057758710766447605", "10.228926520518085" ], [ "9", "Boron1562022", "China", "Boron", "2022", "0.11774602172308436", "0.0976254778505749", "0.29847521717046893", "0.39449178675305485", "0.33945210293993766" ], [ "10", "Cadmium1562022", "China", "Cadmium", "2022", "0.026428358103837278", "0.17856669049440702", "0.19454830922947364", "0.13584470720156452", "2.7662526322172045" ], [ "11", "Chromite1562022", "China", "Chromite", "2022", "0.19862359681683367", "0.15926881019029498", "0.3070140864060876", "0.6469527152383301", "0.3282928823637874" ], [ "12", "Cobalt1562022", "China", "Cobalt", "2022", "0.4325693932200459", "17.164243776457226", "0.4928971158048766", "0.8776058519102541", "16.24540190511184" ], [ "13", "Coking Coal1562022", "China", "Coking Coal", "2022", "0.03040504829579388", "0.014893300555122896", "0.3272799988428909", "0.09290225007116817", "0.20054268706971295" ], [ "14", "Copper1562022", "China", "Copper", "2022", "0.050723813898777524", "0.33164430911470666", "0.10368441992479659", "0.4892134607645782", "2.676838822747666" ], [ "15", "Diatomite1562022", "China", "Diatomite", "2022", "0.003795208311966407", "0.008361129390965734", "0.15162522238314766", "0.0250301912328026", "0.9019675209319644" ], [ "16", "Feldspar1562022", "China", "Feldspar", "2022", "0.00349648697668383", "0.00250011544943821", "0.20066377210066477", "0.01742460504993291", "0.29274515916133487" ], [ "17", "Fluorspar1562022", "China", "Fluorspar", "2022", "0.002042730941896549", "0.0016768084976808634", "0.42615798826202134", "0.0047933653672134965", "0.33607319309002787" ], [ "18", "Germanium1562022", "China", "Germanium", "2022", "0.0", "0.0", "0.8764039128409503", "0.0", "0.0" ], [ "19", "Gold1562022", "China", "Gold", "2022", "0.027371959548577587", "3.5316707378560706", "0.049356777146401465", "0.5545734776682687", "52.8245603163668" ], [ "20", "Graphite1562022", "China", "Graphite", "2022", "0.04241530201200386", "0.06460173046648177", "0.470663478647389", "0.09011810759971987", "0.623567053906595" ], [ "21", "Gypsum1562022", "China", "Gypsum", "2022", "0.0009742649285415945", "0.00012489216301906326", "0.07039292364592355", "0.013840381647481326", "0.05248312563223737" ], [ "22", "Iron1562022", "China", "Iron", "2022", "0.06841081992740715", "0.016974573187842387", "0.20252183624846373", "0.33779478398308316", "0.10158641655297738" ], [ "23", "Kaolin1562022", "China", "Kaolin", "2022", "0.003884208106424958", "0.002608905305348987", "0.10187742563033231", "0.03812628835478249", "0.27499031536157076" ], [ "24", "Lead1562022", "China", "Lead", "2022", "0.055377802067640716", "0.2101432230798394", "0.2016226144381781", "0.2746606685066112", "1.5536072803729477" ], [ "25", "Lignite1562022", "China", "Lignite", "2022", "0.05220313501374145", "0.01186973606060962", "0.08802223420123098", "0.5930675980616201", "0.09309064735818817" ], [ "26", "Lithium1562022", "China", "Lithium", "2022", "0.10939778663755512", "12.002550967511196", "0.31981095428556255", "0.3420701673022516", "44.91863982047043" ], [ "27", "Magnesite1562022", "China", "Magnesite", "2022", "0.0001509219990525094", "7.215560129402191e-05", "0.42040077556916244", "0.0003589955295591038", "0.1957397703844351" ], [ "28", "Manganese1562022", "China", "Manganese", "2022", "0.10928837215731124", "0.04422355880122361", "0.2035183372902862", "0.5369952094362335", "0.16566902061455088" ], [ "29", "Mercury1562022", "China", "Mercury", "2022", "0.030905871879422002", "0.06278486377043065", "0.49775437404450484", "0.0620906083221253", "0.8317169069462647" ], [ "30", "Molybdenum1562022", "China", "Molybdenum", "2022", "0.025076005909895355", "0.8228283068608605", "0.2326102658434335", "0.10780266218677399", "13.434219309894848" ], [ "31", "Natural gas1562022", "China", "Natural gas", "2022", "0.04602111250428812", "0.10100197924798625", "0.1038190611969056", "0.4432819173446717", "0.8985336474406143" ], [ "32", "Nickel1562022", "China", "Nickel", "2022", "0.1672974995645474", "0.03156457019904723", "0.26749007657640966", "0.625434415010002", "0.07724528920743906" ], [ "33", "Niobium1562022", "China", "Niobium", "2022", "0.47792720631772756", "28.95651418754137", "0.8692862183478102", "0.5497926876444555", "24.805392286966356" ], [ "34", "Palladium1562022", "China", "Palladium", "2022", "0.1680769600583267", "31723.15067881988", "0.3236120898438461", "0.5193778765788064", "77273.34332294414" ], [ "35", "Crude oil1562022", "China", "Crude oil", "2022", "0.03498905836878478", "0.06011832256489711", "0.08372461716439887", "0.4179064599373614", "0.7034547603621121" ], [ "36", "Phosphate1562022", "China", "Phosphate", "2022", "8.45787953378266e-07", "2.3552931668967124e-06", "0.2348754375481461", "3.6010063981462157e-06", "1.1401055252819092" ], [ "37", "Platinum1562022", "China", "Platinum", "2022", "0.15788184470138938", "195.78659743314861", "0.5620044925741473", "0.2809263035927768", "507.70605186176425" ], [ "38", "Rare earth1562022", "China", "Rare earth", "2022", "0.06735521129532937", "5.688704005879153", "0.5282617688739127", "0.12750347510271168", "34.578305561753844" ], [ "39", "Rhodium1562022", "China", "Rhodium", "2022", "0.3496015252083816", "358153.3175070907", "0.699713407838737", "0.49963530967374903", "419427.8199134199" ], [ "40", "Selenium1562022", "China", "Selenium", "2022", "0.04461733866513335", "1.9653465901977893", "0.1970920899125283", "0.22637812955829445", "18.03420744956752" ], [ "41", "Silver1562022", "China", "Silver", "2022", "0.064071120205813", "0.3457651924900294", "0.11857763803203183", "0.5403305485685692", "2.2094314305478147" ], [ "42", "Steam Coal1562022", "China", "Steam Coal", "2022", "0.010183207196434264", "0.00420003401813395", "0.3770712498410497", "0.027006055753990486", "0.16886117270270415" ], [ "43", "Sulfur1562022", "China", "Sulfur", "2022", "0.012627354310119503", "0.009276296186308446", "0.08458930789358836", "0.14927837364510016", "0.30076258849521076" ], [ "44", "Tantalum1562022", "China", "Tantalum", "2022", "0.023579665273257465", "13.840821576505155", "0.18845843476299362", "0.12511865177545056", "240.31772710555347" ], [ "45", "Tellurium1562022", "China", "Tellurium", "2022", "0.12763744351211437", "12.062035947150504", "0.5563361300324952", "0.2294250483150522", "38.69047796727572" ], [ "46", "Tin1562022", "China", "Tin", "2022", "0.040842941828769457", "0.7360496127889187", "0.13707362475950757", "0.2979635352930035", "7.3782207733602165" ], [ "47", "Titanium1562022", "China", "Titanium", "2022", "0.0396140972483474", "0.03495718031214001", "0.17493243990142024", "0.2264536941842871", "0.3612835641725462" ], [ "48", "Tungsten1562022", "China", "Tungsten", "2022", "0.030556001597512476", "0.8089467775753436", "0.6007017512773754", "0.05086717581984071", "10.83889473972222" ], [ "49", "Uranium1562022", "China", "Uranium", "2022", "0.00019148748053350706", "0.00937327716943712", "0.24703176337277888", "0.0007751532755103492", "20.040688966550174" ] ], "shape": { "columns": 9, "rows": 212 } }, "text/html": [ "
| \n", " | DBID | \n", "Country [Economic Entity] | \n", "Raw Material | \n", "Year | \n", "GeoPolRisk Score | \n", "GeoPolRisk Characterization Factor [eq. Kg-Cu/Kg] | \n", "HHI | \n", "Import Risk | \n", "Price | \n", "
|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "Aluminium1562022 | \n", "China | \n", "Aluminium | \n", "2022 | \n", "0.003945 | \n", "0.024357 | \n", "0.353279 | \n", "0.011166 | \n", "2.527817 | \n", "
| 1 | \n", "Antimony1562022 | \n", "China | \n", "Antimony | \n", "2022 | \n", "0.076128 | \n", "0.722417 | \n", "0.276644 | \n", "0.275184 | \n", "3.885127 | \n", "
| 2 | \n", "Arsenic1562022 | \n", "China | \n", "Arsenic | \n", "2022 | \n", "0.000152 | \n", "0.075353 | \n", "0.393237 | \n", "0.000387 | \n", "202.750097 | \n", "
| 3 | \n", "Asbestos1562022 | \n", "China | \n", "Asbestos | \n", "2022 | \n", "0.108588 | \n", "0.081655 | \n", "0.334918 | \n", "0.324222 | \n", "0.307868 | \n", "
| 4 | \n", "Baryte1562022 | \n", "China | \n", "Baryte | \n", "2022 | \n", "0.001981 | \n", "0.000536 | \n", "0.151374 | \n", "0.013085 | \n", "0.110799 | \n", "
| ... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
| 207 | \n", "Tungsten362022 | \n", "Australia | \n", "Tungsten | \n", "2022 | \n", "0.050577 | \n", "4.720357 | \n", "0.600702 | \n", "0.084197 | \n", "38.210378 | \n", "
| 208 | \n", "Uranium362022 | \n", "Australia | \n", "Uranium | \n", "2022 | \n", "0.000000 | \n", "0.000000 | \n", "0.247032 | \n", "0.000000 | \n", "0.000000 | \n", "
| 209 | \n", "Vanadium362022 | \n", "Australia | \n", "Vanadium | \n", "2022 | \n", "0.259805 | \n", "6.958138 | \n", "0.502120 | \n", "0.517417 | \n", "10.964943 | \n", "
| 210 | \n", "Zinc362022 | \n", "Australia | \n", "Zinc | \n", "2022 | \n", "0.008650 | \n", "0.043827 | \n", "0.138882 | \n", "0.062280 | \n", "2.074484 | \n", "
| 211 | \n", "Zirconium362022 | \n", "Australia | \n", "Zirconium | \n", "2022 | \n", "0.000821 | \n", "0.004560 | \n", "0.194716 | \n", "0.004217 | \n", "2.273523 | \n", "
212 rows × 9 columns
\n", "| \n", " | DBID | \n", "Country [Economic Entity] | \n", "Raw Material | \n", "Year | \n", "GeoPolRisk Score | \n", "GeoPolRisk Characterization Factor [eq. Kg-Cu/Kg] | \n", "HHI | \n", "Import Risk | \n", "Price | \n", "
|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "AluminiumEFTA2022 | \n", "EFTA | \n", "Aluminium | \n", "2022 | \n", "0.028892 | \n", "0.250305 | \n", "0.353279 | \n", "0.081781 | \n", "3.546990 | \n", "
| 1 | \n", "AntimonyEFTA2022 | \n", "EFTA | \n", "Antimony | \n", "2022 | \n", "0.115442 | \n", "0.011542 | \n", "0.276644 | \n", "0.417296 | \n", "0.040934 | \n", "
| 2 | \n", "ArsenicEFTA2022 | \n", "EFTA | \n", "Arsenic | \n", "2022 | \n", "0.164176 | \n", "4.912686 | \n", "0.393237 | \n", "0.417499 | \n", "12.250974 | \n", "
| 3 | \n", "AsbestosEFTA2022 | \n", "EFTA | \n", "Asbestos | \n", "2022 | \n", "0.189662 | \n", "0.236331 | \n", "0.334918 | \n", "0.566294 | \n", "0.510155 | \n", "
| 4 | \n", "BaryteEFTA2022 | \n", "EFTA | \n", "Baryte | \n", "2022 | \n", "0.070911 | \n", "0.034209 | \n", "0.151374 | \n", "0.468447 | \n", "0.197513 | \n", "
| ... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
| 101 | \n", "TungstenNAFTA2022 | \n", "NAFTA | \n", "Tungsten | \n", "2022 | \n", "0.228728 | \n", "18.544553 | \n", "0.600702 | \n", "0.380767 | \n", "33.193985 | \n", "
| 102 | \n", "UraniumNAFTA2022 | \n", "NAFTA | \n", "Uranium | \n", "2022 | \n", "0.021769 | \n", "5.251664 | \n", "0.247032 | \n", "0.088121 | \n", "98.770603 | \n", "
| 103 | \n", "VanadiumNAFTA2022 | \n", "NAFTA | \n", "Vanadium | \n", "2022 | \n", "0.214775 | \n", "16.578472 | \n", "0.502120 | \n", "0.427737 | \n", "31.602510 | \n", "
| 104 | \n", "ZincNAFTA2022 | \n", "NAFTA | \n", "Zinc | \n", "2022 | \n", "0.010950 | \n", "0.050845 | \n", "0.138882 | \n", "0.078843 | \n", "1.901065 | \n", "
| 105 | \n", "ZirconiumNAFTA2022 | \n", "NAFTA | \n", "Zirconium | \n", "2022 | \n", "0.071479 | \n", "0.394452 | \n", "0.194716 | \n", "0.367096 | \n", "2.259305 | \n", "
106 rows × 9 columns
\n", "