diff --git a/week13/inClass_week13.ipynb b/week13/inClass_week13.ipynb index 44e4897..9f4ef5a 100644 --- a/week13/inClass_week13.ipynb +++ b/week13/inClass_week13.ipynb @@ -265,7 +265,7 @@ { "cell_type": "code", "execution_count": 5, - "id": "79c98763", + "id": "72bf03e7", "metadata": {}, "outputs": [ { @@ -358,7 +358,7 @@ { "cell_type": "code", "execution_count": 6, - "id": "b8e397fc", + "id": "a1dd0e15", "metadata": {}, "outputs": [ { @@ -390,7 +390,7 @@ { "cell_type": "code", "execution_count": 7, - "id": "f55e1d5f", + "id": "027bff29", "metadata": {}, "outputs": [], "source": [ @@ -400,7 +400,7 @@ { "cell_type": "code", "execution_count": 8, - "id": "9718c9a2", + "id": "1c925fa3", "metadata": {}, "outputs": [ { @@ -610,7 +610,7 @@ { "cell_type": "code", "execution_count": 9, - "id": "ece95375", + "id": "ef3177cd", "metadata": {}, "outputs": [ { @@ -703,7 +703,7 @@ { "cell_type": "code", "execution_count": 10, - "id": "470bd37d", + "id": "1d79f69f", "metadata": {}, "outputs": [], "source": [ @@ -713,7 +713,7 @@ { "cell_type": "code", "execution_count": 11, - "id": "b4da08b5", + "id": "883b1c90", "metadata": {}, "outputs": [ { @@ -958,7 +958,7 @@ { "cell_type": "code", "execution_count": 12, - "id": "81f0acbc", + "id": "00218b71", "metadata": {}, "outputs": [], "source": [ @@ -970,7 +970,7 @@ { "cell_type": "code", "execution_count": 17, - "id": "37507751", + "id": "08c8a2b3", "metadata": {}, "outputs": [ { @@ -1055,7 +1055,7 @@ { "cell_type": "code", "execution_count": 18, - "id": "6fbb8fcf", + "id": "13e1ee2a", "metadata": {}, "outputs": [ { @@ -1149,7 +1149,7 @@ { "cell_type": "code", "execution_count": 19, - "id": "a05e335c", + "id": "2346e0c7", "metadata": {}, "outputs": [], "source": [ @@ -1159,7 +1159,7 @@ { "cell_type": "code", "execution_count": 21, - "id": "ff56bcd9", + "id": "03ebb3b0", "metadata": {}, "outputs": [ { @@ -1180,7 +1180,7 @@ { "cell_type": "code", "execution_count": 28, - "id": "ba93279f", + "id": "8b1c14e8", "metadata": {}, "outputs": [ { @@ -1280,7 +1280,7 @@ { "cell_type": "code", "execution_count": 29, - "id": "7d532aec", + "id": "95e014b7", "metadata": {}, "outputs": [ { @@ -1525,7 +1525,7 @@ { "cell_type": "code", "execution_count": 31, - "id": "1b39ff1f", + "id": "3a8b52dd", "metadata": {}, "outputs": [], "source": [ @@ -1567,7 +1567,7 @@ { "cell_type": "code", "execution_count": 33, - "id": "643e22b3", + "id": "7854e23c", "metadata": {}, "outputs": [ { @@ -1589,7 +1589,7 @@ { "cell_type": "code", "execution_count": 34, - "id": "82fcc929", + "id": "bf746f98", "metadata": {}, "outputs": [ { @@ -1611,7 +1611,7 @@ { "cell_type": "code", "execution_count": 35, - "id": "dad41ac4", + "id": "cdca7d37", "metadata": {}, "outputs": [ { @@ -1633,7 +1633,7 @@ { "cell_type": "code", "execution_count": 36, - "id": "74129831", + "id": "093547d3", "metadata": {}, "outputs": [ { @@ -1661,7 +1661,7 @@ { "cell_type": "code", "execution_count": 37, - "id": "ed2dd95f", + "id": "d785cf58", "metadata": {}, "outputs": [ { @@ -1732,7 +1732,7 @@ { "cell_type": "code", "execution_count": 38, - "id": "ca5ff505", + "id": "8e50da92", "metadata": {}, "outputs": [ { @@ -1753,7 +1753,7 @@ { "cell_type": "code", "execution_count": 39, - "id": "29d272f5", + "id": "327be9a9", "metadata": {}, "outputs": [ { @@ -1998,10 +1998,719 @@ "corg_clean.head()" ] }, + { + "cell_type": "code", + "execution_count": 40, + "id": "51215bed", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "United States 39.7837304 -100.445882\n", + "Brazil -10.3333333 -53.2\n", + "Russia 64.6863136 97.7453061\n", + "Japan 36.5748441 139.2394179\n", + "Vietnam 15.9266657 107.9650855\n", + "Germany 51.1638175 10.4478313\n", + "France 46.603354 1.8883335\n", + "United Kingdom 54.7023545 -3.2765753\n", + "Italy 42.6384261 12.674297\n", + "South Africa -28.8166236 24.991639\n", + "Ukraine 49.4871968 31.2718321\n", + "Spain 39.3260685 -4.8379791\n", + "Poland 52.215933 19.134422\n", + "Canada 61.0666922 -107.991707\n", + "Korea, North 40.3736611 127.0870417\n", + "Romania 45.9852129 24.6859225\n", + "Australia -24.7761086 134.755\n", + "Portugal 39.6621648 -8.1353519\n", + "Belgium 50.6402809 4.6667145\n", + "Czech Republic 49.7439047 15.3381061\n", + "Hungary 47.1817585 19.5060937\n", + "Belarus 53.4250605 27.6971358\n", + "Sweden 59.6749712 14.5208584\n", + "Austria 47.59397 14.12456\n", + "Switzerland 46.7985624 8.2319736\n", + "Israel 31.39480005 34.63358319049945\n", + "Serbia 44.1534121 20.55144\n", + "Denmark 55.670249 10.3333283\n", + "Finland 63.2467777 25.9209164\n", + "Norway 61.1529386 8.7876653\n", + "Croatia 45.3658443 15.6575209\n", + "New Zealand -41.5000831 172.8344077\n", + "Ireland 52.865196 -7.9794599\n", + "Lithuania 55.3500003 23.7499997\n", + "Uruguay -32.8755548 -56.0201525\n", + "Latvia 56.8406494 24.7537645\n", + "Slovenia 46.1199444 14.8153333\n", + "Estonia 58.7523778 25.3319078\n", + "Netherlands 52.24764975 5.541246849406163\n", + "Kosovo 42.5869578 20.9021231\n" + ] + } + ], + "source": [ + "lat, long = [], []\n", + "for c in corg_clean.columns:\n", + " la,lo = get_boundingbox_country(c)\n", + " print(c,la,lo)\n", + " lat.append(la); long.append(lo)" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "id": "e7e12845", + "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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
United StatesBrazilRussiaJapanVietnamGermanyFranceUnited KingdomItalySouth Africa...CroatiaNew ZealandIrelandLithuaniaUruguayLatviaSloveniaEstoniaNetherlandsKosovo
Years
1917-01-010000000100...0000000000
1918-01-010000000000...0000000000
1919-01-010000000000...0000000001
1920-01-010000000000...0000000000
1921-01-010000000000...0000000000
..................................................................
2016-01-0122902172054552820...8309000271772
2017-01-0121302602128601040...4300200825101
2018-01-011980329034225520...6300000161256
2019-01-011180189003062120...0000000161251
2020-01-0120160000000...00000000017
\n", + "

104 rows × 40 columns

\n", + "
" + ], + "text/plain": [ + " United States Brazil Russia Japan Vietnam Germany France \\\n", + "Years \n", + "1917-01-01 0 0 0 0 0 0 0 \n", + "1918-01-01 0 0 0 0 0 0 0 \n", + "1919-01-01 0 0 0 0 0 0 0 \n", + "1920-01-01 0 0 0 0 0 0 0 \n", + "1921-01-01 0 0 0 0 0 0 0 \n", + "... ... ... ... ... ... ... ... \n", + "2016-01-01 229 0 217 2 0 54 55 \n", + "2017-01-01 213 0 260 2 1 28 60 \n", + "2018-01-01 198 0 329 0 3 42 25 \n", + "2019-01-01 118 0 189 0 0 30 62 \n", + "2020-01-01 2 0 16 0 0 0 0 \n", + "\n", + " United Kingdom Italy South Africa ... Croatia New Zealand \\\n", + "Years ... \n", + "1917-01-01 1 0 0 ... 0 0 \n", + "1918-01-01 0 0 0 ... 0 0 \n", + "1919-01-01 0 0 0 ... 0 0 \n", + "1920-01-01 0 0 0 ... 0 0 \n", + "1921-01-01 0 0 0 ... 0 0 \n", + "... ... ... ... ... ... ... \n", + "2016-01-01 28 2 0 ... 8 3 \n", + "2017-01-01 10 4 0 ... 4 3 \n", + "2018-01-01 5 2 0 ... 6 3 \n", + "2019-01-01 1 2 0 ... 0 0 \n", + "2020-01-01 0 0 0 ... 0 0 \n", + "\n", + " Ireland Lithuania Uruguay Latvia Slovenia Estonia \\\n", + "Years \n", + "1917-01-01 0 0 0 0 0 0 \n", + "1918-01-01 0 0 0 0 0 0 \n", + "1919-01-01 0 0 0 0 0 0 \n", + "1920-01-01 0 0 0 0 0 0 \n", + "1921-01-01 0 0 0 0 0 0 \n", + "... ... ... ... ... ... ... \n", + "2016-01-01 0 9 0 0 0 27 \n", + "2017-01-01 0 0 2 0 0 8 \n", + "2018-01-01 0 0 0 0 0 16 \n", + "2019-01-01 0 0 0 0 0 16 \n", + "2020-01-01 0 0 0 0 0 0 \n", + "\n", + " Netherlands Kosovo \n", + "Years \n", + "1917-01-01 0 0 \n", + "1918-01-01 0 0 \n", + "1919-01-01 0 1 \n", + "1920-01-01 0 0 \n", + "1921-01-01 0 0 \n", + "... ... ... \n", + "2016-01-01 17 72 \n", + "2017-01-01 25 101 \n", + "2018-01-01 12 56 \n", + "2019-01-01 12 51 \n", + "2020-01-01 0 17 \n", + "\n", + "[104 rows x 40 columns]" + ] + }, + "execution_count": 41, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "corg_clean" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "id": "b0cd7843", + "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", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Years1917-01-011918-01-011919-01-011920-01-011921-01-011922-01-011923-01-011924-01-011925-01-011926-01-01...2011-01-012012-01-012013-01-012014-01-012015-01-012016-01-012017-01-012018-01-012019-01-012020-01-01
United States0000000000...4084313762803012292131981182
Brazil0000000000...0000000000
Russia0000000000...898211512723721726032918916
Japan0000000000...0000022000
Vietnam0000000000...0000001300
\n", + "

5 rows × 104 columns

\n", + "
" + ], + "text/plain": [ + "Years 1917-01-01 1918-01-01 1919-01-01 1920-01-01 1921-01-01 \\\n", + "United States 0 0 0 0 0 \n", + "Brazil 0 0 0 0 0 \n", + "Russia 0 0 0 0 0 \n", + "Japan 0 0 0 0 0 \n", + "Vietnam 0 0 0 0 0 \n", + "\n", + "Years 1922-01-01 1923-01-01 1924-01-01 1925-01-01 1926-01-01 \\\n", + "United States 0 0 0 0 0 \n", + "Brazil 0 0 0 0 0 \n", + "Russia 0 0 0 0 0 \n", + "Japan 0 0 0 0 0 \n", + "Vietnam 0 0 0 0 0 \n", + "\n", + "Years ... 2011-01-01 2012-01-01 2013-01-01 2014-01-01 \\\n", + "United States ... 408 431 376 280 \n", + "Brazil ... 0 0 0 0 \n", + "Russia ... 89 82 115 127 \n", + "Japan ... 0 0 0 0 \n", + "Vietnam ... 0 0 0 0 \n", + "\n", + "Years 2015-01-01 2016-01-01 2017-01-01 2018-01-01 2019-01-01 \\\n", + "United States 301 229 213 198 118 \n", + "Brazil 0 0 0 0 0 \n", + "Russia 237 217 260 329 189 \n", + "Japan 0 2 2 0 0 \n", + "Vietnam 0 0 1 3 0 \n", + "\n", + "Years 2020-01-01 \n", + "United States 2 \n", + "Brazil 0 \n", + "Russia 16 \n", + "Japan 0 \n", + "Vietnam 0 \n", + "\n", + "[5 rows x 104 columns]" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "corg_clean_t = corg_clean.T\n", + "corg_clean_t.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "ce6f880f", + "metadata": {}, + "outputs": [], + "source": [ + "corg_clean_t.index.name" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "e7e2cd64", + "id": "87a827d1", "metadata": {}, "outputs": [], "source": []