{ "cells": [ { "cell_type": "markdown", "id": "e0a0c11e-f954-4a25-821e-af48a595a944", "metadata": { "tags": [] }, "source": [ "# Human Interactions\n", "\n", "IN THE SPACE BELOW, WRITE OUT IN FULL AND THEN SIGN THE HONOR PLEDGE:\n", "\n", "“I pledge my honor that I have not violated the honor code during this examination.”\n", "\n", "**PRINT NAME**: \n", "\n", "If a fellow student has contributed significantly to this work, please acknowledge them here:\n", "\n", "**Peer(s)**: \n", "\n", "*Contribution:*\n", "\n", "\n", "By uploading this assignment through Canvas, I sign off on the document below electronically.\n", "\n", "----" ] }, { "cell_type": "markdown", "id": "1f891def-3a54-40d0-b140-5f3320a03fd1", "metadata": { "tags": [] }, "source": [ "## Part I: A modified ranking of costly disasters\n", "\n", "The following table list some recent natural disasters, and the estimated economic losses in the affected country. The economic losses are often hard to estimate, so these are approximate values.\n", "\n", "|Year|Event |Country |Economic loss|\n", "|----|-------------------------|--------|-------------|\n", "|2010|Port-au-Prince Earthquake|Haiti | \\$3 billion|\n", "|2014|Laudian Earthquake |China | \\$10 billion|\n", "|2005|Hurricane Katrina |USA |\\$150 billion|\n", "|2011|M9.1 Earthquake |Japan |\\$200 billion|\n", "|2012|Hurricane Sandy |USA |\\$150 billion|\n", "|1998|Hurricane Mitch |Honduras| \\$4 billion|" ] }, { "cell_type": "markdown", "id": "f65a64ed-62d9-4461-b194-2916a10bd13b", "metadata": {}, "source": [ "We will rank the severity of the disasters based on the economic losses compared with the national wealth, estimated as their gross domestic products (GDPs, [Wikipedia](https://en.wikipedia.org/wiki/Gross_domestic_product)). Here is an example on how to read a `.csv` file and access the data using a `pandas` Dataframe." ] }, { "cell_type": "code", "execution_count": 1, "id": "5c8b0710-57f9-457c-a05a-28fae38725ad", "metadata": { "tags": [] }, "outputs": [], "source": [ "# import these packages when you read .csv file\n", "import pandas as pd\n", "\n", "# this one is only for making interactive plots. You do not need to import this.\n", "import plotly.express as px" ] }, { "cell_type": "code", "execution_count": 2, "id": "fd7a4be2-6237-4eba-b5ac-3bb928c4bfd9", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", " | Country Name | \n", "Country Code | \n", "Indicator Name | \n", "Indicator Code | \n", "1960 | \n", "1961 | \n", "1962 | \n", "1963 | \n", "1964 | \n", "1965 | \n", "... | \n", "2012 | \n", "2013 | \n", "2014 | \n", "2015 | \n", "2016 | \n", "2017 | \n", "2018 | \n", "2019 | \n", "2020 | \n", "2021 | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "Tuvalu | \n", "TUV | \n", "GDP (current US$) | \n", "NY.GDP.MKTP.CD | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "... | \n", "3.934562e+07 | \n", "3.861749e+07 | \n", "3.875969e+07 | \n", "3.681166e+07 | \n", "4.162950e+07 | \n", "4.521766e+07 | \n", "4.781829e+07 | \n", "5.422315e+07 | \n", "5.505471e+07 | \n", "6.310096e+07 | \n", "
1 | \n", "Nauru | \n", "NRU | \n", "GDP (current US$) | \n", "NY.GDP.MKTP.CD | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "... | \n", "9.692720e+07 | \n", "9.849184e+07 | \n", "1.046544e+08 | \n", "8.652966e+07 | \n", "9.972339e+07 | \n", "1.093597e+08 | \n", "1.240214e+08 | \n", "1.187241e+08 | \n", "1.146266e+08 | \n", "1.332189e+08 | \n", "
2 | \n", "Kiribati | \n", "KIR | \n", "GDP (current US$) | \n", "NY.GDP.MKTP.CD | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "... | \n", "1.896301e+08 | \n", "1.845507e+08 | \n", "1.778623e+08 | \n", "1.702910e+08 | \n", "1.785098e+08 | \n", "1.881921e+08 | \n", "1.962306e+08 | \n", "1.779353e+08 | \n", "1.809118e+08 | \n", "NaN | \n", "
3 | \n", "Marshall Islands | \n", "MHL | \n", "GDP (current US$) | \n", "NY.GDP.MKTP.CD | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "... | \n", "1.804363e+08 | \n", "1.848404e+08 | \n", "1.821428e+08 | \n", "1.838143e+08 | \n", "2.015109e+08 | \n", "2.132041e+08 | \n", "2.215889e+08 | \n", "2.394622e+08 | \n", "2.444624e+08 | \n", "2.486656e+08 | \n", "
4 | \n", "Palau | \n", "PLW | \n", "GDP (current US$) | \n", "NY.GDP.MKTP.CD | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "... | \n", "2.123978e+08 | \n", "2.211172e+08 | \n", "2.416698e+08 | \n", "2.804577e+08 | \n", "2.983000e+08 | \n", "2.853000e+08 | \n", "2.847000e+08 | \n", "2.742000e+08 | \n", "2.577000e+08 | \n", "NaN | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
261 | \n", "Sint Maarten (Dutch part) | \n", "SXM | \n", "GDP (current US$) | \n", "NY.GDP.MKTP.CD | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "... | \n", "9.858659e+08 | \n", "1.022905e+09 | \n", "1.245251e+09 | \n", "1.253073e+09 | \n", "1.263687e+09 | \n", "1.191620e+09 | \n", "1.185475e+09 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
262 | \n", "Syrian Arab Republic | \n", "SYR | \n", "GDP (current US$) | \n", "NY.GDP.MKTP.CD | \n", "8.577044e+08 | \n", "9.452450e+08 | \n", "1.110566e+09 | \n", "1.200447e+09 | \n", "1.339494e+09 | \n", "1.329842e+09 | \n", "... | \n", "4.411780e+10 | \n", "2.255247e+10 | \n", "2.207599e+10 | \n", "1.762206e+10 | \n", "1.245346e+10 | \n", "1.634067e+10 | \n", "2.144578e+10 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
263 | \n", "Turkmenistan | \n", "TKM | \n", "GDP (current US$) | \n", "NY.GDP.MKTP.CD | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "... | \n", "3.516421e+10 | \n", "3.919754e+10 | \n", "4.352421e+10 | \n", "3.579971e+10 | \n", "3.616943e+10 | \n", "3.792629e+10 | \n", "4.076543e+10 | \n", "4.523143e+10 | \n", "NaN | \n", "NaN | \n", "
264 | \n", "Venezuela, RB | \n", "VEN | \n", "GDP (current US$) | \n", "NY.GDP.MKTP.CD | \n", "7.779091e+09 | \n", "8.189091e+09 | \n", "8.946970e+09 | \n", "9.753333e+09 | \n", "8.099318e+09 | \n", "8.427778e+09 | \n", "... | \n", "3.812860e+11 | \n", "3.710050e+11 | \n", "4.823590e+11 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
265 | \n", "British Virgin Islands | \n", "VGB | \n", "GDP (current US$) | \n", "NY.GDP.MKTP.CD | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
266 rows × 66 columns
\n", "\n", " | Country Name | \n", "Country Code | \n", "Indicator Name | \n", "Indicator Code | \n", "1960 | \n", "1961 | \n", "1962 | \n", "1963 | \n", "1964 | \n", "1965 | \n", "... | \n", "2012 | \n", "2013 | \n", "2014 | \n", "2015 | \n", "2016 | \n", "2017 | \n", "2018 | \n", "2019 | \n", "2020 | \n", "2021 | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
79 | \n", "Haiti | \n", "HTI | \n", "GDP (current US$) | \n", "NY.GDP.MKTP.CD | \n", "2.731872e+08 | \n", "2.710660e+08 | \n", "2.818968e+08 | \n", "2.948834e+08 | \n", "3.252812e+08 | \n", "3.532518e+08 | \n", "... | \n", "1.370893e+10 | \n", "1.490247e+10 | \n", "1.513926e+10 | \n", "1.483315e+10 | \n", "1.398769e+10 | \n", "1.503556e+10 | \n", "1.645503e+10 | \n", "1.478584e+10 | \n", "1.450822e+10 | \n", "2.094439e+10 | \n", "
97 | \n", "Honduras | \n", "HND | \n", "GDP (current US$) | \n", "NY.GDP.MKTP.CD | \n", "3.356500e+08 | \n", "3.562000e+08 | \n", "3.877500e+08 | \n", "4.102000e+08 | \n", "4.570000e+08 | \n", "5.086500e+08 | \n", "... | \n", "1.852860e+10 | \n", "1.849971e+10 | \n", "1.975649e+10 | \n", "2.097977e+10 | \n", "2.171762e+10 | \n", "2.313623e+10 | \n", "2.406778e+10 | \n", "2.508998e+10 | \n", "2.382784e+10 | \n", "2.848867e+10 | \n", "
229 | \n", "Japan | \n", "JPN | \n", "GDP (current US$) | \n", "NY.GDP.MKTP.CD | \n", "4.430734e+10 | \n", "5.350862e+10 | \n", "6.072302e+10 | \n", "6.949813e+10 | \n", "8.174901e+10 | \n", "9.095028e+10 | \n", "... | \n", "6.272360e+12 | \n", "5.212330e+12 | \n", "4.896990e+12 | \n", "4.444930e+12 | \n", "5.003680e+12 | \n", "4.930840e+12 | \n", "5.037840e+12 | \n", "5.123320e+12 | \n", "5.040110e+12 | \n", "4.937420e+12 | \n", "
233 | \n", "China | \n", "CHN | \n", "GDP (current US$) | \n", "NY.GDP.MKTP.CD | \n", "5.971647e+10 | \n", "5.005687e+10 | \n", "4.720936e+10 | \n", "5.070680e+10 | \n", "5.970834e+10 | \n", "7.043627e+10 | \n", "... | \n", "8.532230e+12 | \n", "9.570410e+12 | \n", "1.047570e+13 | \n", "1.106160e+13 | \n", "1.123330e+13 | \n", "1.231040e+13 | \n", "1.389480e+13 | \n", "1.427990e+13 | \n", "1.468770e+13 | \n", "1.773410e+13 | \n", "
237 | \n", "United States | \n", "USA | \n", "GDP (current US$) | \n", "NY.GDP.MKTP.CD | \n", "5.433000e+11 | \n", "5.633000e+11 | \n", "6.051000e+11 | \n", "6.386000e+11 | \n", "6.858000e+11 | \n", "7.437000e+11 | \n", "... | \n", "1.625400e+13 | \n", "1.684320e+13 | \n", "1.755070e+13 | \n", "1.820600e+13 | \n", "1.869510e+13 | \n", "1.947960e+13 | \n", "2.052720e+13 | \n", "2.137260e+13 | \n", "2.089370e+13 | \n", "2.299610e+13 | \n", "
5 rows × 66 columns
\n", "\n", " | time | \n", "latitude | \n", "longitude | \n", "depth | \n", "mag | \n", "magType | \n", "nst | \n", "gap | \n", "dmin | \n", "rms | \n", "... | \n", "updated | \n", "place | \n", "type | \n", "horizontalError | \n", "depthError | \n", "magError | \n", "magNst | \n", "status | \n", "locationSource | \n", "magSource | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "1983-01-01T01:32:35.610Z | \n", "38.198000 | \n", "-118.488000 | \n", "3.599 | \n", "2.89 | \n", "ml | \n", "0.0 | \n", "247.30 | \n", "NaN | \n", "0.8580 | \n", "... | \n", "2016-02-02T18:50:21.010Z | \n", "38km SSE of Hawthorne, NV | \n", "earthquake | \n", "NaN | \n", "NaN | \n", "0.018 | \n", "4.0 | \n", "reviewed | \n", "ci | \n", "ci | \n", "
1 | \n", "1983-01-01T02:17:55.930Z | \n", "35.745500 | \n", "-117.722000 | \n", "5.680 | \n", "2.01 | \n", "mc | \n", "20.0 | \n", "53.00 | \n", "NaN | \n", "0.1200 | \n", "... | \n", "2016-02-03T01:12:47.200Z | \n", "14km NE of Inyokern, CA | \n", "earthquake | \n", "0.28 | \n", "1.27 | \n", "NaN | \n", "17.0 | \n", "reviewed | \n", "ci | \n", "ci | \n", "
2 | \n", "1983-01-01T03:56:55.920Z | \n", "33.933333 | \n", "-118.812000 | \n", "0.353 | \n", "2.16 | \n", "mh | \n", "21.0 | \n", "194.00 | \n", "NaN | \n", "0.2100 | \n", "... | \n", "2016-04-01T23:29:13.318Z | \n", "8km S of Malibu, CA | \n", "earthquake | \n", "0.85 | \n", "1.05 | \n", "0.309 | \n", "11.0 | \n", "reviewed | \n", "ci | \n", "ci | \n", "
3 | \n", "1983-01-01T04:03:54.690Z | \n", "35.810000 | \n", "-117.735500 | \n", "5.245 | \n", "2.50 | \n", "ml | \n", "31.0 | \n", "60.00 | \n", "NaN | \n", "0.1800 | \n", "... | \n", "2016-04-01T20:13:31.091Z | \n", "19km NNE of Inyokern, CA | \n", "earthquake | \n", "0.34 | \n", "1.14 | \n", "0.013 | \n", "4.0 | \n", "reviewed | \n", "ci | \n", "ci | \n", "
4 | \n", "1983-01-01T04:12:21.890Z | \n", "35.816500 | \n", "-117.739000 | \n", "4.979 | \n", "2.85 | \n", "ml | \n", "35.0 | \n", "61.00 | \n", "NaN | \n", "0.2100 | \n", "... | \n", "2016-04-02T12:24:09.816Z | \n", "20km NNE of Inyokern, CA | \n", "earthquake | \n", "0.40 | \n", "1.07 | \n", "0.202 | \n", "10.0 | \n", "reviewed | \n", "ci | \n", "ci | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
231157 | \n", "2012-12-31T21:00:14.700Z | \n", "34.914000 | \n", "-119.593000 | \n", "7.565 | \n", "2.43 | \n", "ml | \n", "44.0 | \n", "53.00 | \n", "0.15010 | \n", "0.2600 | \n", "... | \n", "2022-07-24T14:45:00.773Z | \n", "24km SW of Maricopa, CA | \n", "earthquake | \n", "0.38 | \n", "0.86 | \n", "0.160 | \n", "67.0 | \n", "reviewed | \n", "ci | \n", "ci | \n", "
231158 | \n", "2012-12-31T21:00:40.960Z | \n", "37.637333 | \n", "-122.496833 | \n", "8.540 | \n", "2.11 | \n", "md | \n", "97.0 | \n", "93.00 | \n", "0.01712 | \n", "0.0800 | \n", "... | \n", "2022-07-24T14:43:42.150Z | \n", "2 km NNW of Pacifica, California | \n", "earthquake | \n", "0.14 | \n", "0.18 | \n", "0.152 | \n", "63.0 | \n", "reviewed | \n", "nc | \n", "nc | \n", "
231159 | \n", "2012-12-31T21:22:24.430Z | \n", "40.434500 | \n", "-123.364833 | \n", "28.967 | \n", "2.42 | \n", "md | \n", "33.0 | \n", "33.00 | \n", "0.08919 | \n", "0.2100 | \n", "... | \n", "2017-01-29T05:39:58.660Z | \n", "12 km E of Mad River, California | \n", "earthquake | \n", "0.41 | \n", "0.99 | \n", "0.130 | \n", "32.0 | \n", "reviewed | \n", "nc | \n", "nc | \n", "
231160 | \n", "2012-12-31T22:36:06.070Z | \n", "38.817833 | \n", "-122.798333 | \n", "1.100 | \n", "2.06 | \n", "md | \n", "60.0 | \n", "20.00 | \n", "0.00991 | \n", "0.0700 | \n", "... | \n", "2017-01-29T05:40:38.730Z | \n", "6 km W of Cobb, California | \n", "earthquake | \n", "0.10 | \n", "0.18 | \n", "0.142 | \n", "31.0 | \n", "reviewed | \n", "nc | \n", "nc | \n", "
231161 | \n", "2012-12-31T23:02:17.428Z | \n", "38.716200 | \n", "-116.689600 | \n", "0.000 | \n", "2.10 | \n", "ml | \n", "5.0 | \n", "230.45 | \n", "1.14800 | \n", "0.2014 | \n", "... | \n", "2018-06-29T20:50:58.679Z | \n", "63 km SSE of Kingston, Nevada | \n", "earthquake | \n", "NaN | \n", "0.00 | \n", "0.050 | \n", "2.0 | \n", "reviewed | \n", "nn | \n", "nn | \n", "
231162 rows × 22 columns
\n", "