{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Introduction\n", "The purpose of this notebook is to explore the miliary data from data.world. I'm mostly interested in the size of the military relative to the country, or active members per capita." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2019-03-24T00:46:28.684451Z", "start_time": "2019-03-24T00:46:28.396905Z" } }, "outputs": [], "source": [ "import plotly_express as px\n" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "ExecuteTime": { "end_time": "2019-03-24T00:51:56.998222Z", "start_time": "2019-03-24T00:51:56.345951Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 172 entries, 0 to 171\n", "Data columns (total 8 columns):\n", "Country 172 non-null object\n", "Active military 171 non-null object\n", "Reserve military 171 non-null object\n", "Paramilitary 171 non-null object\n", "Total 172 non-null object\n", "Per 1000 capita (total) 172 non-null float64\n", "Per 1000 capita (active) 171 non-null float64\n", "Unnamed: 7 0 non-null float64\n", "dtypes: float64(3), object(5)\n", "memory usage: 10.8+ KB\n" ] } ], "source": [ "df = pd.read_csv('C:/Users/willk/Downloads/Military Data .csv')\n", "df.info()" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "ExecuteTime": { "end_time": "2019-03-24T00:52:00.496853Z", "start_time": "2019-03-24T00:51:59.621195Z" } }, "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", "
countryactivereserveparatotaltotal_per_1000active_per_1000
0Afghanistan171,2000148,200319,4009.65.1
1Albania8,00005008,5002.82.6
2Algeria130,000150,000187,200467,20011.63.2
3Angola107,000010,000117,0005.85.3
4Antigua and Barbuda1808002602.81.9
\n", "
" ], "text/plain": [ " country active reserve para total total_per_1000 \\\n", "0 Afghanistan 171,200 0 148,200 319,400 9.6 \n", "1 Albania 8,000 0 500 8,500 2.8 \n", "2 Algeria 130,000 150,000 187,200 467,200 11.6 \n", "3 Angola 107,000 0 10,000 117,000 5.8 \n", "4 Antigua and Barbuda 180 80 0 260 2.8 \n", "\n", " active_per_1000 \n", "0 5.1 \n", "1 2.6 \n", "2 3.2 \n", "3 5.3 \n", "4 1.9 " ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.columns = ['country', 'active', 'reserve', 'para', 'total',\n", " 'total_per_1000', 'active_per_1000', 'unknown']\n", "df = df.drop(columns=['unknown'])\n", "df.to_csv('military_data.csv')\n", "df.head()" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "ExecuteTime": { "end_time": "2019-03-24T00:52:24.997728Z", "start_time": "2019-03-24T00:52:24.259701Z" } }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "hovertemplate": "%{hovertext}

active=%{x}
active_per_1000=%{y}", "hovertext": [ "Afghanistan", "Albania", "Algeria", "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan", "The Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Kingdom of Belgium", "Belize", "Benin", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Central African Republic", "Chad", "Chile", "People's Republic of China", "Colombia", "Costa Rica", "Ivory Coast", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Democratic Republic of the Congo", "Denmark", "Djibouti", "Dominican Republic", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Republic of Fiji", "Finland", "France", "Gabon", "The Gambia", "Georgia ", "Germany", "Ghana", "Greece", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Honduras", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Republic of Kosovo", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Lithuania", "Luxembourg", "Madagascar", "Malawi", "Malaysia", "Mali", "Malta", "Mauritania", "Mauritius", "Mexico", "Moldova", "Mongolia", "Montenegro", "Morocco", "Mozambique", "Myanmar ", "Namibia", "Nepal", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "North Korea", "Kingdom of Norway", "Oman", "Pakistan", "State of Palestine", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Qatar", "Macedonia", "Republic of the Congo", "Romania", "Russia", "Rwanda", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Republic of Singapore", "Slovakia", "Slovenia", "Somalia", "Republic of South Africa", "South Korea", "Kingdom of Spain", "Sri Lanka", "South Sudan", "Sudan", "Suriname", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "East Timor", "Togo", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom of Great Britain and Northern Ireland", "United States of America", "Uruguay", "Uzbekistan", "Venezuela", "Vietnam", "Yemen", "Zambia", "Zimbabwe" ], "legendgroup": "", "marker": { "color": "#636efa", "symbol": "circle" }, "mode": "markers", "name": " ", "showlegend": false, "type": "scatter", "uid": "46b9fd38-d91d-4e0d-8ca0-e76d60e5ddfd", "x": [ "171,200", "8,000", "130,000", "107,000", "180", "74,200", "44,800", "57,800", "21,350", "66,950", "1,300", "8,200", "157,050", "610", "62,000", "29,600", "1,500", "7,250", "34,100", "10,500", "9,000", "334,500", "7,000", "31,300", "11,200", "30,000", "124,300", "14,400", "63,000", "1,200", "7,150", "30,350", "64,750", "2,183,000", "293,200", "0", "25,400", "15,550", "49,000", "12,000", "21,950", "134,250", "16,600", "10,450", "56,050", "40,250", "438,500", "24,500", "1,450", "201,750", "6,400", "138,000", "3,500", "22,200", "202,950", "4,700", "800", "20,650", "176,800", "15,500", "142,950", "18,050", "9,700", "4,450", "3,400", "70", "10,700", "26,500", "0", "1,395,100", "395,500", "523,000", "64,000", "9,100", "176,500", "174,500", "3,450", "247,150", "100,500", "39,000", "24,100", "2,500", "15,500", "10,900", "29,100", "5,310", "60,000", "2,000", "2,050", "0", "17,030", "900", "13,500", "5,300", "109,000", "8,000", "1,950", "15,850", "0", "277,150", "5,150", "20,000", "1,950", "195,800", "11,200", "406,000", "9,900", "96,600", "35,410", "8,950", "12,000", "5,300", "118,000", "1,190,000", "24,950", "42,600", "653,800", null, "0", "1,900", "10,650", "81,000", "125,000", "99,300", "29,600", "11,800", "8,000", "10,000", "70,500", "1,013,000", "33,000", "227,000", "13,600", "28,150", "420", "8,500", "72,500", "15,850", "7,250", "19,800", "67,100", "630,000", "123,200", "243,000", "185,000", "244,300", "1,840", "29,750", "20,950", "127,500", "215,000", "8,800", "27,000", "360,850", "1,330", "8,550", "4,050", "35,800", "355,200", "36,500", "45,000", "204,000", "63,000", "152,350", "1,347,300", "24,650", "48,000", "115,000", "482,000", "20,000", "15,100", "29,000" ], "xaxis": "x", "y": [ 5.1, 2.6, 3.2, 5.3, 1.9, 1.7, 14.7, 2.5, 2.5, 6.8, 4, 5.9, 1, 2.1, 6.5, 2.6, 4.2, 0.7, 3.1, 2.7, 4.1, 1.6, 16, 4.4, 0.6, 2.7, 7.8, 0.6, 1.8, 2.2, 1.3, 2.6, 3.7, 1.6, 6.2, 0, 1.1, 3.6, 4.4, 10, 2.1, 1.7, 3, 12.3, 5.3, 2.5, 4.6, 4, 1.9, 34.4, 5.1, 1.3, 3.8, 4, 3, 2.7, 0.4, 4.2, 2.2, 0.6, 13.3, 1.2, 0.8, 2.5, 4.6, 0, 1.2, 2.7, 0, 1.1, 1.5, 6.3, 1.7, 1.8, 21.6, 2.8, 1.2, 2, 12.3, 2.1, 0.5, 1.3, 5.5, 1.9, 4.1, 2.7, 9.6, 1, 0.5, 0, 6, 1.5, 0.6, 0.3, 3.5, 0.5, 4.7, 4.3, 0, 2.3, 1.5, 6.3, 3, 5.8, 0.4, 7.1, 4.2, 3.3, 2.1, 2, 2, 0.3, 0.6, 47.4, 4.7, 12.7, 3.2, null, 0, 0.3, 1.6, 2.6, 1.2, 2.6, 2.7, 5.2, 3.8, 2.1, 3.3, 7.1, 2.5, 8.1, 0.9, 3.9, 4.5, 1.4, 12.5, 2.9, 3.7, 1.8, 1.2, 12.4, 2.5, 10.9, 14.8, 6.7, 3.1, 3, 2.6, 7.4, 9.2, 1.1, 0.5, 5.3, 1.1, 1.1, 3.3, 3.2, 4.4, 6.9, 1.2, 4.6, 10.6, 2.4, 4.2, 7.4, 1.6, 3.7, 5.1, 0.7, 1, 2 ], "yaxis": "y" } ], "layout": { "grid": { "xaxes": [ "x" ], "xgap": 0.1, "xside": "bottom", "yaxes": [ "y" ], "ygap": 0.1, "yside": "left" }, "height": 600, "legend": { "tracegroupgap": 0 }, "margin": { "t": 60 }, "template": { "data": { "bar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "autocolorscale": true, "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "autocolorscale": true, "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "autocolorscale": true, "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "histogram2d" } ], "histogram2dcontour": [ { "autocolorscale": true, "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#506784", "arrowhead": 0, "arrowwidth": 1 }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0508b8" ], [ 0.0893854748603352, "#1910d8" ], [ 0.1787709497206704, "#3c19f0" ], [ 0.2681564245810056, "#6b1cfb" ], [ 0.3575418994413408, "#981cfd" ], [ 0.44692737430167595, "#bf1cfd" ], [ 0.5363128491620112, "#dd2bfd" ], [ 0.6256983240223464, "#f246fe" ], [ 0.7150837988826816, "#fc67fd" ], [ 0.8044692737430168, "#fe88fc" ], [ 0.8938547486033519, "#fea5fd" ], [ 0.9832402234636871, "#febefe" ], [ 1, "#fec3fe" ] ], "sequentialminus": [ [ 0, "#0508b8" ], [ 0.0893854748603352, "#1910d8" ], [ 0.1787709497206704, "#3c19f0" ], [ 0.2681564245810056, "#6b1cfb" ], [ 0.3575418994413408, "#981cfd" ], [ 0.44692737430167595, "#bf1cfd" ], [ 0.5363128491620112, "#dd2bfd" ], [ 0.6256983240223464, "#f246fe" ], [ 0.7150837988826816, "#fc67fd" ], [ 0.8044692737430168, "#fe88fc" ], [ 0.8938547486033519, "#fea5fd" ], [ 0.9832402234636871, "#febefe" ], [ 1, "#fec3fe" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#19d3f3", "#e763fa", "#FECB52", "#FFA15A", "#FF6692", "#B6E880" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "fillcolor": "#506784", "line": { "width": 0 }, "opacity": 0.4 }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "zerolinecolor": "white", "zerolinewidth": 2 } } }, "xaxis": { "title": { "text": "active" } }, "yaxis": { "title": { "text": "active_per_1000" } } } }, "text/html": [ "
" ], "text/vnd.plotly.v1+html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "px.scatter(df, 'active', 'active_per_1000',\n", "hover_name='country')" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "ExecuteTime": { "end_time": "2019-03-24T00:52:19.418755Z", "start_time": "2019-03-24T00:52:18.431391Z" } }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "hovertemplate": "%{hovertext}

total=%{x}
total_per_1000=%{y}", "hovertext": [ "Afghanistan", "Albania", "Algeria", "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan", "The Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Kingdom of Belgium", "Belize", "Benin", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Central African Republic", "Chad", "Chile", "People's Republic of China", "Colombia", "Costa Rica", "Ivory Coast", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Democratic Republic of the Congo", "Denmark", "Djibouti", "Dominican Republic", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Republic of Fiji", "Finland", "France", "Gabon", "The Gambia", "Georgia ", "Germany", "Ghana", "Greece", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Honduras", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Republic of Kosovo", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Lithuania", "Luxembourg", "Madagascar", "Malawi", "Malaysia", "Mali", "Malta", "Mauritania", "Mauritius", "Mexico", "Moldova", "Mongolia", "Montenegro", "Morocco", "Mozambique", "Myanmar ", "Namibia", "Nepal", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "North Korea", "Kingdom of Norway", "Oman", "Pakistan", "State of Palestine", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Qatar", "Macedonia", "Republic of the Congo", "Romania", "Russia", "Rwanda", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Republic of Singapore", "Slovakia", "Slovenia", "Somalia", "Republic of South Africa", "South Korea", "Kingdom of Spain", "Sri Lanka", "South Sudan", "Sudan", "Suriname", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "East Timor", "Togo", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom of Great Britain and Northern Ireland", "United States of America", "Uruguay", "Uzbekistan", "Venezuela", "Vietnam", "Yemen", "Zambia", "Zimbabwe" ], "legendgroup": "", "marker": { "color": "#636efa", "symbol": "circle" }, "mode": "markers", "name": " ", "showlegend": false, "type": "scatter", "uid": "bc536215-4488-4fdb-845a-55e07581814f", "x": [ "319,400", "8,500", "467,200", "117,000", "260", "105,450", "259,100", "78,900", "167,350", "381,950", "1,300", "19,460", "220,950", "1,040", "556,750", "36,350", "2,200", "9,750", "71,200", "10,500", "9,000", "2,069,500", "9,950", "50,300", "11,450", "51,000", "191,300", "23,400", "97,500", "1,200", "8,150", "39,850", "149,450", "3,353,000", "516,050", "9,800", "25,400", "18,550", "1,234,500", "62,750", "25,050", "134,250", "62,300", "12,950", "71,050", "158,750", "1,314,500", "51,400", "1,450", "321,750", "34,200", "138,000", "9,500", "924,900", "374,450", "6,700", "800", "26,050", "204,900", "15,500", "367,450", "106,900", "12,300", "4,450", "4,070", "120", "78,700", "82,500", "250", "4,941,600", "1,075,500", "913,000", "209,000", "11,730", "649,500", "375,150", "4,430", "315,800", "180,500", "70,500", "29,100", "3,300", "46,300", "20,400", "129,100", "13,160", "80,000", "2,000", "2,050", "0", "35,030", "1,500", "21,600", "6,800", "429,900", "15,800", "2,130", "20,850", "2,550", "417,550", "65,550", "285,000", "12,050", "395,800", "11,200", "513,250", "15,900", "158,600", "45,970", "11,150", "12,000", "10,700", "200,000", "7,679,000", "70,540", "47,000", "935,800", "0", "22,050", "1,900", "189,950", "346,000", "346,500", "172,700", "285,550", "11,800", "12,850", "12,000", "200,400", "4,223,000", "35,000", "251,500", "18,600", "78,300", "420", "8,500", "504,100", "15,850", "14,960", "19,800", "82,150", "8,134,500", "208,150", "341,100", "185,000", "349,300", "1,940", "51,700", "239,220", "277,500", "1,889,000", "16,300", "108,400", "699,550", "1,330", "9,300", "4,050", "47,800", "890,700", "36,500", "56,400", "1,192,000", "63,000", "233,700", "2,227,200", "25,450", "68,000", "123,000", "5,522,000", "20,000", "19,500", "50,800" ], "xaxis": "x", "y": [ 9.6, 2.8, 11.6, 5.8, 2.8, 2.4, 84.9, 3.4, 19.2, 38.7, 4, 14.1, 1.4, 3.6, 58.2, 3.2, 6.2, 0.9, 6.5, 2.7, 4.1, 10.1, 22.8, 7, 0.6, 4.6, 12, 1, 2.8, 2.2, 1.5, 3.4, 8.5, 2.4, 10.9, 2, 1.1, 4.3, 110.4, 52, 2.3, 1.7, 11.1, 15.3, 6.7, 9.9, 13.9, 8.3, 1.9, 54.8, 27.2, 1.3, 10.4, 168.2, 5.6, 3.9, 0.4, 5.3, 2.5, 0.6, 34.1, 7, 1, 2.5, 5.5, 0, 8.8, 8.4, 0.7, 3.9, 4.2, 11, 5.5, 2.4, 79.5, 6.1, 1.5, 2.5, 22.1, 3.8, 0.6, 1.8, 16.3, 3.6, 18.4, 6.7, 12.8, 1, 0.5, 0, 12.3, 2.6, 0.9, 0.4, 13.9, 0.9, 5.1, 5.7, 1.9, 3.4, 18.7, 89.3, 18.7, 11.8, 0.4, 9, 6.8, 5.5, 2.7, 2.5, 2, 0.6, 1.1, 305.7, 13.4, 14, 4.6, 0, 6, 0.3, 27.7, 11.3, 3.4, 4.5, 26.4, 5.2, 6.1, 2.5, 9.3, 29.7, 2.7, 8.9, 1.3, 11, 4.5, 1.4, 87.2, 2.9, 7.6, 1.8, 1.5, 159.7, 4.3, 15.3, 14.8, 9.5, 3.3, 5.2, 29.2, 16.1, 80.5, 2, 2.1, 10.3, 1.1, 1.2, 3.3, 4.3, 11.1, 6.9, 1.5, 27, 10.6, 3.6, 6.9, 7.6, 2.3, 4, 58, 0.7, 1.3, 3.5 ], "yaxis": "y" } ], "layout": { "grid": { "xaxes": [ "x" ], "xgap": 0.1, "xside": "bottom", "yaxes": [ "y" ], "ygap": 0.1, "yside": "left" }, "height": 600, "legend": { "tracegroupgap": 0 }, "margin": { "t": 60 }, "template": { "data": { "bar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "autocolorscale": true, "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "autocolorscale": true, "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "autocolorscale": true, "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "histogram2d" } ], "histogram2dcontour": [ { "autocolorscale": true, "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#506784", "arrowhead": 0, "arrowwidth": 1 }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0508b8" ], [ 0.0893854748603352, "#1910d8" ], [ 0.1787709497206704, "#3c19f0" ], [ 0.2681564245810056, "#6b1cfb" ], [ 0.3575418994413408, "#981cfd" ], [ 0.44692737430167595, "#bf1cfd" ], [ 0.5363128491620112, "#dd2bfd" ], [ 0.6256983240223464, "#f246fe" ], [ 0.7150837988826816, "#fc67fd" ], [ 0.8044692737430168, "#fe88fc" ], [ 0.8938547486033519, "#fea5fd" ], [ 0.9832402234636871, "#febefe" ], [ 1, "#fec3fe" ] ], "sequentialminus": [ [ 0, "#0508b8" ], [ 0.0893854748603352, "#1910d8" ], [ 0.1787709497206704, "#3c19f0" ], [ 0.2681564245810056, "#6b1cfb" ], [ 0.3575418994413408, "#981cfd" ], [ 0.44692737430167595, "#bf1cfd" ], [ 0.5363128491620112, "#dd2bfd" ], [ 0.6256983240223464, "#f246fe" ], [ 0.7150837988826816, "#fc67fd" ], [ 0.8044692737430168, "#fe88fc" ], [ 0.8938547486033519, "#fea5fd" ], [ 0.9832402234636871, "#febefe" ], [ 1, "#fec3fe" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#19d3f3", "#e763fa", "#FECB52", "#FFA15A", "#FF6692", "#B6E880" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "fillcolor": "#506784", "line": { "width": 0 }, "opacity": 0.4 }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "zerolinecolor": "white", "zerolinewidth": 2 } } }, "xaxis": { "title": { "text": "total" } }, "yaxis": { "title": { "text": "total_per_1000" } } } }, "text/html": [ "
" ], "text/vnd.plotly.v1+html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "px.scatter(df, 'total', 'total_per_1000', hover_name='country')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "px.scatter_geo()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "df.columns = ['country', 'active', ]" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "px.scatter(df, 'Active military', 'Per 1000 capita (active)')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Imports\n", "Import libraries and write settings here." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2019-03-24T00:46:32.371897Z", "start_time": "2019-03-24T00:46:32.152483Z" } }, "outputs": [ { "data": { "text/html": [ "" ], "text/vnd.plotly.v1+html": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/vnd.plotly.v1+html": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Data manipulation\n", "import pandas as pd\n", "import numpy as np\n", "\n", "# Options for pandas\n", "pd.options.display.max_columns = 50\n", "pd.options.display.max_rows = 30\n", "\n", "# Display all cell outputs\n", "from IPython.core.interactiveshell import InteractiveShell\n", "InteractiveShell.ast_node_interactivity = 'all'\n", "\n", "from IPython import get_ipython\n", "ipython = get_ipython()\n", "\n", "# autoreload extension\n", "if 'autoreload' not in ipython.extension_manager.loaded:\n", " %load_ext autoreload\n", "\n", "%autoreload 2\n", "\n", "# Visualizations\n", "import plotly.plotly as py\n", "import plotly.graph_objs as go\n", "from plotly.offline import iplot, init_notebook_mode\n", "init_notebook_mode(connected=True)\n", "\n", "import cufflinks as cf\n", "cf.go_offline(connected=True)\n", "cf.set_config_file(theme='white')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Analysis/Modeling\n", "Do work here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Results\n", "Show graphs and stats here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Conclusions and Next Steps\n", "Summarize findings here" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }