diff --git a/bad-drivers/analysis/README.md.txt b/bad-drivers/analysis/README.md.txt new file mode 100644 index 00000000..64fc9b98 --- /dev/null +++ b/bad-drivers/analysis/README.md.txt @@ -0,0 +1,13 @@ +# Bad Drivers – Risk & Insurance Impact Analysis + +This analysis explores how fatal crash risk, drunk driving, and driver behavior +relate to insurance premiums and insurer losses across U.S. states. + +It answers questions like: +- Do high-risk states pay more for insurance? +- Are some states underpriced relative to their crash risk? +- Does alcohol-impaired driving increase insurer losses? +- Are drivers in high-risk states paying appropriately higher insurance premiums? + +Data source: FiveThirtyEight Bad Drivers dataset +Tools: Python, Pandas diff --git a/bad-drivers/analysis/analysis.ipynb b/bad-drivers/analysis/analysis.ipynb new file mode 100644 index 00000000..079bb6c3 --- /dev/null +++ b/bad-drivers/analysis/analysis.ipynb @@ -0,0 +1,1972 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 275 + }, + "id": "DJcu1TifB4JD", + "outputId": "3fd3ed65-dd29-4322-9b96-e2f5a60109a2" + }, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " State \\\n", + "0 Alabama \n", + "1 Alaska \n", + "2 Arizona \n", + "3 Arkansas \n", + "4 California \n", + "\n", + " Number of drivers involved in fatal collisions per billion miles \\\n", + "0 18.8 \n", + "1 18.1 \n", + "2 18.6 \n", + "3 22.4 \n", + "4 12.0 \n", + "\n", + " Percentage Of Drivers Involved In Fatal Collisions Who Were Speeding \\\n", + "0 39 \n", + "1 41 \n", + "2 35 \n", + "3 18 \n", + "4 35 \n", + "\n", + " Percentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-Impaired \\\n", + "0 30 \n", + "1 25 \n", + "2 28 \n", + "3 26 \n", + "4 28 \n", + "\n", + " Percentage Of Drivers Involved In Fatal Collisions Who Were Not Distracted \\\n", + "0 96 \n", + "1 90 \n", + "2 84 \n", + "3 94 \n", + "4 91 \n", + "\n", + " Percentage Of Drivers Involved In Fatal Collisions Who Had Not Been Involved In Any Previous Accidents \\\n", + "0 80 \n", + "1 94 \n", + "2 96 \n", + "3 95 \n", + "4 89 \n", + "\n", + " Car Insurance Premiums ($) \\\n", + "0 784.55 \n", + "1 1053.48 \n", + "2 899.47 \n", + "3 827.34 \n", + "4 878.41 \n", + "\n", + " Losses incurred by insurance companies for collisions per insured driver ($) \n", + "0 145.08 \n", + "1 133.93 \n", + "2 110.35 \n", + "3 142.39 \n", + "4 165.63 " + ], + "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", + "
StateNumber of drivers involved in fatal collisions per billion milesPercentage Of Drivers Involved In Fatal Collisions Who Were SpeedingPercentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-ImpairedPercentage Of Drivers Involved In Fatal Collisions Who Were Not DistractedPercentage Of Drivers Involved In Fatal Collisions Who Had Not Been Involved In Any Previous AccidentsCar Insurance Premiums ($)Losses incurred by insurance companies for collisions per insured driver ($)
0Alabama18.839309680784.55145.08
1Alaska18.1412590941053.48133.93
2Arizona18.635288496899.47110.35
3Arkansas22.418269495827.34142.39
4California12.035289189878.41165.63
\n", + "
\n", + "
\n", + "\n", + "
\n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
\n", + "\n", + "\n", + "
\n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
\n", + "\n", + "
\n", + "
\n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "variable_name": "df", + "summary": "{\n \"name\": \"df\",\n \"rows\": 51,\n \"fields\": [\n {\n \"column\": \"State\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 51,\n \"samples\": [\n \"Texas\",\n \"South Carolina\",\n \"Virginia\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Number of drivers involved in fatal collisions per billion miles\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 4.122002178648661,\n \"min\": 5.9,\n \"max\": 23.9,\n \"num_unique_values\": 45,\n \"samples\": [\n 11.3,\n 16.1,\n 14.9\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Percentage Of Drivers Involved In Fatal Collisions Who Were Speeding\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 9,\n \"min\": 13,\n \"max\": 54,\n \"num_unique_values\": 29,\n \"samples\": [\n 30,\n 24,\n 25\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Percentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-Impaired\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 5,\n \"min\": 16,\n \"max\": 44,\n \"num_unique_values\": 19,\n \"samples\": [\n 30,\n 27,\n 33\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Percentage Of Drivers Involved In Fatal Collisions Who Were Not Distracted\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 15,\n \"min\": 10,\n \"max\": 100,\n \"num_unique_values\": 26,\n \"samples\": [\n 92,\n 71,\n 96\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Percentage Of Drivers Involved In Fatal Collisions Who Had Not Been Involved In Any Previous Accidents\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 6,\n \"min\": 76,\n \"max\": 100,\n \"num_unique_values\": 22,\n \"samples\": [\n 80,\n 84,\n 93\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Car Insurance Premiums ($)\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 178.29628479122306,\n \"min\": 641.96,\n \"max\": 1301.52,\n \"num_unique_values\": 51,\n \"samples\": [\n 1004.75,\n 858.97,\n 768.95\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Losses incurred by insurance companies for collisions per insured driver ($)\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 24.83592249063409,\n \"min\": 82.75,\n \"max\": 194.78,\n \"num_unique_values\": 51,\n \"samples\": [\n 156.83,\n 116.29,\n 153.72\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 1 + } + ], + "source": [ + "import pandas as pd\n", + "\n", + "url = \"https://raw.githubusercontent.com/fivethirtyeight/data/master/bad-drivers/bad-drivers.csv\"\n", + "df = pd.read_csv(url)\n", + "\n", + "df.head()\n" + ] + }, + { + "cell_type": "markdown", + "source": [ + "# Bad Drivers – Risk & Insurance Impact Analysis\n", + "\n", + "This notebook analyzes how driving risk and driver behavior relate to\n", + "insurance premiums and insurance company losses across U.S. states.\n", + "\n", + "Data Source: FiveThirtyEight Bad Drivers dataset\n" + ], + "metadata": { + "id": "TBh9NMxfIBVW" + } + }, + { + "cell_type": "code", + "source": [ + "df.info()\n", + "df.isna().sum()\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 595 + }, + "id": "FMHGop8rCKhN", + "outputId": "cf0ac19a-a26c-4d92-c419-cfaa91ac9ecd" + }, + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "\n", + "RangeIndex: 51 entries, 0 to 50\n", + "Data columns (total 8 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 State 51 non-null object \n", + " 1 Number of drivers involved in fatal collisions per billion miles 51 non-null float64\n", + " 2 Percentage Of Drivers Involved In Fatal Collisions Who Were Speeding 51 non-null int64 \n", + " 3 Percentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-Impaired 51 non-null int64 \n", + " 4 Percentage Of Drivers Involved In Fatal Collisions Who Were Not Distracted 51 non-null int64 \n", + " 5 Percentage Of Drivers Involved In Fatal Collisions Who Had Not Been Involved In Any Previous Accidents 51 non-null int64 \n", + " 6 Car Insurance Premiums ($) 51 non-null float64\n", + " 7 Losses incurred by insurance companies for collisions per insured driver ($) 51 non-null float64\n", + "dtypes: float64(3), int64(4), object(1)\n", + "memory usage: 3.3+ KB\n" + ] + }, + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "State 0\n", + "Number of drivers involved in fatal collisions per billion miles 0\n", + "Percentage Of Drivers Involved In Fatal Collisions Who Were Speeding 0\n", + "Percentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-Impaired 0\n", + "Percentage Of Drivers Involved In Fatal Collisions Who Were Not Distracted 0\n", + "Percentage Of Drivers Involved In Fatal Collisions Who Had Not Been Involved In Any Previous Accidents 0\n", + "Car Insurance Premiums ($) 0\n", + "Losses incurred by insurance companies for collisions per insured driver ($) 0\n", + "dtype: int64" + ], + "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", + "
0
State0
Number of drivers involved in fatal collisions per billion miles0
Percentage Of Drivers Involved In Fatal Collisions Who Were Speeding0
Percentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-Impaired0
Percentage Of Drivers Involved In Fatal Collisions Who Were Not Distracted0
Percentage Of Drivers Involved In Fatal Collisions Who Had Not Been Involved In Any Previous Accidents0
Car Insurance Premiums ($)0
Losses incurred by insurance companies for collisions per insured driver ($)0
\n", + "

" + ] + }, + "metadata": {}, + "execution_count": 2 + } + ] + }, + { + "cell_type": "code", + "source": [ + "#Do risky states pay more for car insurance?\n", + "df[[\n", + " \"Number of drivers involved in fatal collisions per billion miles\",\n", + " \"Car Insurance Premiums ($)\"\n", + "]].corr()\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 112 + }, + "id": "xmF7evkVIHXK", + "outputId": "3975c3ff-21c7-4940-f104-f9c45e2e96a3" + }, + "execution_count": 3, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Number of drivers involved in fatal collisions per billion miles \\\n", + "Number of drivers involved in fatal collisions ... 1.000000 \n", + "Car Insurance Premiums ($) -0.199702 \n", + "\n", + " Car Insurance Premiums ($) \n", + "Number of drivers involved in fatal collisions ... -0.199702 \n", + "Car Insurance Premiums ($) 1.000000 " + ], + "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", + "
Number of drivers involved in fatal collisions per billion milesCar Insurance Premiums ($)
Number of drivers involved in fatal collisions per billion miles1.000000-0.199702
Car Insurance Premiums ($)-0.1997021.000000
\n", + "
\n", + "
\n", + "\n", + "
\n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
\n", + "\n", + "\n", + "
\n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
\n", + "\n", + "
\n", + "
\n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"]]\",\n \"rows\": 2,\n \"fields\": [\n {\n \"column\": \"Number of drivers involved in fatal collisions per billion miles\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.8483173812000535,\n \"min\": -0.1997019456899424,\n \"max\": 1.0,\n \"num_unique_values\": 2,\n \"samples\": [\n -0.1997019456899424,\n 1.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Car Insurance Premiums ($)\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.8483173812000535,\n \"min\": -0.1997019456899424,\n \"max\": 1.0,\n \"num_unique_values\": 2,\n \"samples\": [\n 1.0,\n -0.1997019456899424\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 3 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Insight\n", + "\n", + "The correlation between fatal crash rates and insurance premiums is weak and negative (-0.20).\n", + "This suggests that states with higher crash risk do not necessarily have higher insurance costs,\n", + "indicating potential mispricing of risk by insurers.\n" + ], + "metadata": { + "id": "dEOHA0-NKlcU" + } + }, + { + "cell_type": "code", + "source": [ + "#Does drunk driving increase insurance company losses?\n", + "df[[\n", + " \"Percentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-Impaired\",\n", + " \"Losses incurred by insurance companies for collisions per insured driver ($)\"\n", + "]].corr()\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 164 + }, + "id": "H1RDjyr3JgjU", + "outputId": "66e4b18d-ed9b-4102-f875-7c63d16e8899" + }, + "execution_count": 4, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " Percentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-Impaired \\\n", + "Percentage Of Drivers Involved In Fatal Collisi... 1.000000 \n", + "Losses incurred by insurance companies for coll... -0.083916 \n", + "\n", + " Losses incurred by insurance companies for collisions per insured driver ($) \n", + "Percentage Of Drivers Involved In Fatal Collisi... -0.083916 \n", + "Losses incurred by insurance companies for coll... 1.000000 " + ], + "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", + "
Percentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-ImpairedLosses incurred by insurance companies for collisions per insured driver ($)
Percentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-Impaired1.000000-0.083916
Losses incurred by insurance companies for collisions per insured driver ($)-0.0839161.000000
\n", + "
\n", + "
\n", + "\n", + "
\n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
\n", + "\n", + "\n", + "
\n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
\n", + "\n", + "
\n", + "
\n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"]]\",\n \"rows\": 2,\n \"fields\": [\n {\n \"column\": \"Percentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-Impaired\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.7664443037214924,\n \"min\": -0.08391592912653814,\n \"max\": 1.0,\n \"num_unique_values\": 2,\n \"samples\": [\n -0.08391592912653814,\n 1.0\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Losses incurred by insurance companies for collisions per insured driver ($)\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 0.7664443037214924,\n \"min\": -0.08391592912653814,\n \"max\": 1.0,\n \"num_unique_values\": 2,\n \"samples\": [\n 1.0,\n -0.08391592912653814\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 4 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Insight\n", + "\n", + "The correlation between alcohol-impaired fatal crashes and insurance losses is very weak (-0.08).\n", + "This suggests that drunk-driving rates alone do not strongly explain how much insurers lose per driver.\n" + ], + "metadata": { + "id": "Xrji4xk5MUGW" + } + }, + { + "cell_type": "code", + "source": [ + "#Are drivers in high-risk states paying appropriately higher insurance premiums?\n", + "df[\"Risk\"] = df[\"Number of drivers involved in fatal collisions per billion miles\"]\n", + "df[\"Price\"] = df[\"Car Insurance Premiums ($)\"]\n", + "\n", + "df.sort_values(\"Risk\", ascending=False).head()\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 327 + }, + "id": "RoydcL2HMc0r", + "outputId": "a1ad540c-3665-4aa8-b202-a8236730eb28" + }, + "execution_count": 5, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " State \\\n", + "34 North Dakota \n", + "40 South Carolina \n", + "48 West Virginia \n", + "3 Arkansas \n", + "26 Montana \n", + "\n", + " Number of drivers involved in fatal collisions per billion miles \\\n", + "34 23.9 \n", + "40 23.9 \n", + "48 23.8 \n", + "3 22.4 \n", + "26 21.4 \n", + "\n", + " Percentage Of Drivers Involved In Fatal Collisions Who Were Speeding \\\n", + "34 23 \n", + "40 38 \n", + "48 34 \n", + "3 18 \n", + "26 39 \n", + "\n", + " Percentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-Impaired \\\n", + "34 42 \n", + "40 41 \n", + "48 28 \n", + "3 26 \n", + "26 44 \n", + "\n", + " Percentage Of Drivers Involved In Fatal Collisions Who Were Not Distracted \\\n", + "34 99 \n", + "40 96 \n", + "48 97 \n", + "3 94 \n", + "26 84 \n", + "\n", + " Percentage Of Drivers Involved In Fatal Collisions Who Had Not Been Involved In Any Previous Accidents \\\n", + "34 86 \n", + "40 81 \n", + "48 87 \n", + "3 95 \n", + "26 85 \n", + "\n", + " Car Insurance Premiums ($) \\\n", + "34 688.75 \n", + "40 858.97 \n", + "48 992.61 \n", + "3 827.34 \n", + "26 816.21 \n", + "\n", + " Losses incurred by insurance companies for collisions per insured driver ($) \\\n", + "34 109.72 \n", + "40 116.29 \n", + "48 152.56 \n", + "3 142.39 \n", + "26 85.15 \n", + "\n", + " Risk Price \n", + "34 23.9 688.75 \n", + "40 23.9 858.97 \n", + "48 23.8 992.61 \n", + "3 22.4 827.34 \n", + "26 21.4 816.21 " + ], + "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", + "
StateNumber of drivers involved in fatal collisions per billion milesPercentage Of Drivers Involved In Fatal Collisions Who Were SpeedingPercentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-ImpairedPercentage Of Drivers Involved In Fatal Collisions Who Were Not DistractedPercentage Of Drivers Involved In Fatal Collisions Who Had Not Been Involved In Any Previous AccidentsCar Insurance Premiums ($)Losses incurred by insurance companies for collisions per insured driver ($)RiskPrice
34North Dakota23.923429986688.75109.7223.9688.75
40South Carolina23.938419681858.97116.2923.9858.97
48West Virginia23.834289787992.61152.5623.8992.61
3Arkansas22.418269495827.34142.3922.4827.34
26Montana21.439448485816.2185.1521.4816.21
\n", + "
\n", + "
\n", + "\n", + "
\n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
\n", + "\n", + "\n", + "
\n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
\n", + "\n", + "
\n", + "
\n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"df\",\n \"rows\": 5,\n \"fields\": [\n {\n \"column\": \"State\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 5,\n \"samples\": [\n \"South Carolina\",\n \"Montana\",\n \"West Virginia\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Number of drivers involved in fatal collisions per billion miles\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1.1344602240713426,\n \"min\": 21.4,\n \"max\": 23.9,\n \"num_unique_values\": 4,\n \"samples\": [\n 23.8,\n 21.4,\n 23.9\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Percentage Of Drivers Involved In Fatal Collisions Who Were Speeding\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 9,\n \"min\": 18,\n \"max\": 39,\n \"num_unique_values\": 5,\n \"samples\": [\n 38,\n 39,\n 34\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Percentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-Impaired\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 8,\n \"min\": 26,\n \"max\": 44,\n \"num_unique_values\": 5,\n \"samples\": [\n 41,\n 44,\n 28\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Percentage Of Drivers Involved In Fatal Collisions Who Were Not Distracted\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 5,\n \"min\": 84,\n \"max\": 99,\n \"num_unique_values\": 5,\n \"samples\": [\n 96,\n 84,\n 97\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Percentage Of Drivers Involved In Fatal Collisions Who Had Not Been Involved In Any Previous Accidents\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 5,\n \"min\": 81,\n \"max\": 95,\n \"num_unique_values\": 5,\n \"samples\": [\n 81,\n 85,\n 87\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Car Insurance Premiums ($)\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 108.62838524069113,\n \"min\": 688.75,\n \"max\": 992.61,\n \"num_unique_values\": 5,\n \"samples\": [\n 858.97,\n 816.21,\n 992.61\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Losses incurred by insurance companies for collisions per insured driver ($)\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 26.869891514481406,\n \"min\": 85.15,\n \"max\": 152.56,\n \"num_unique_values\": 5,\n \"samples\": [\n 116.29,\n 85.15,\n 152.56\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Risk\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 1.1344602240713426,\n \"min\": 21.4,\n \"max\": 23.9,\n \"num_unique_values\": 4,\n \"samples\": [\n 23.8,\n 21.4,\n 23.9\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Price\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 108.62838524069113,\n \"min\": 688.75,\n \"max\": 992.61,\n \"num_unique_values\": 5,\n \"samples\": [\n 858.97,\n 816.21,\n 992.61\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 5 + } + ] + }, + { + "cell_type": "code", + "source": [ + "df.sort_values(\"Price\", ascending=False).head()\n" + ], + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 327 + }, + "id": "eTJ57leqMzrE", + "outputId": "e7459ba0-48d3-4f37-fc91-b82f9acb3c59" + }, + "execution_count": 6, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + " State \\\n", + "30 New Jersey \n", + "18 Louisiana \n", + "8 District of Columbia \n", + "32 New York \n", + "9 Florida \n", + "\n", + " Number of drivers involved in fatal collisions per billion miles \\\n", + "30 11.2 \n", + "18 20.5 \n", + "8 5.9 \n", + "32 12.3 \n", + "9 17.9 \n", + "\n", + " Percentage Of Drivers Involved In Fatal Collisions Who Were Speeding \\\n", + "30 16 \n", + "18 35 \n", + "8 34 \n", + "32 32 \n", + "9 21 \n", + "\n", + " Percentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-Impaired \\\n", + "30 28 \n", + "18 33 \n", + "8 27 \n", + "32 29 \n", + "9 29 \n", + "\n", + " Percentage Of Drivers Involved In Fatal Collisions Who Were Not Distracted \\\n", + "30 86 \n", + "18 73 \n", + "8 100 \n", + "32 88 \n", + "9 92 \n", + "\n", + " Percentage Of Drivers Involved In Fatal Collisions Who Had Not Been Involved In Any Previous Accidents \\\n", + "30 78 \n", + "18 98 \n", + "8 100 \n", + "32 80 \n", + "9 94 \n", + "\n", + " Car Insurance Premiums ($) \\\n", + "30 1301.52 \n", + "18 1281.55 \n", + "8 1273.89 \n", + "32 1234.31 \n", + "9 1160.13 \n", + "\n", + " Losses incurred by insurance companies for collisions per insured driver ($) \\\n", + "30 159.85 \n", + "18 194.78 \n", + "8 136.05 \n", + "32 150.01 \n", + "9 144.18 \n", + "\n", + " Risk Price \n", + "30 11.2 1301.52 \n", + "18 20.5 1281.55 \n", + "8 5.9 1273.89 \n", + "32 12.3 1234.31 \n", + "9 17.9 1160.13 " + ], + "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", + "
StateNumber of drivers involved in fatal collisions per billion milesPercentage Of Drivers Involved In Fatal Collisions Who Were SpeedingPercentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-ImpairedPercentage Of Drivers Involved In Fatal Collisions Who Were Not DistractedPercentage Of Drivers Involved In Fatal Collisions Who Had Not Been Involved In Any Previous AccidentsCar Insurance Premiums ($)Losses incurred by insurance companies for collisions per insured driver ($)RiskPrice
30New Jersey11.2162886781301.52159.8511.21301.52
18Louisiana20.5353373981281.55194.7820.51281.55
8District of Columbia5.934271001001273.89136.055.91273.89
32New York12.3322988801234.31150.0112.31234.31
9Florida17.9212992941160.13144.1817.91160.13
\n", + "
\n", + "
\n", + "\n", + "
\n", + " \n", + "\n", + " \n", + "\n", + " \n", + "
\n", + "\n", + "\n", + "
\n", + " \n", + "\n", + "\n", + "\n", + " \n", + "
\n", + "\n", + "
\n", + "
\n" + ], + "application/vnd.google.colaboratory.intrinsic+json": { + "type": "dataframe", + "summary": "{\n \"name\": \"df\",\n \"rows\": 5,\n \"fields\": [\n {\n \"column\": \"State\",\n \"properties\": {\n \"dtype\": \"string\",\n \"num_unique_values\": 5,\n \"samples\": [\n \"Louisiana\",\n \"Florida\",\n \"District of Columbia\"\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Number of drivers involved in fatal collisions per billion miles\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 5.762638284674824,\n \"min\": 5.9,\n \"max\": 20.5,\n \"num_unique_values\": 5,\n \"samples\": [\n 20.5,\n 17.9,\n 5.9\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Percentage Of Drivers Involved In Fatal Collisions Who Were Speeding\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 8,\n \"min\": 16,\n \"max\": 35,\n \"num_unique_values\": 5,\n \"samples\": [\n 35,\n 21,\n 34\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Percentage Of Drivers Involved In Fatal Collisions Who Were Alcohol-Impaired\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 2,\n \"min\": 27,\n \"max\": 33,\n \"num_unique_values\": 4,\n \"samples\": [\n 33,\n 29,\n 28\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Percentage Of Drivers Involved In Fatal Collisions Who Were Not Distracted\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 9,\n \"min\": 73,\n \"max\": 100,\n \"num_unique_values\": 5,\n \"samples\": [\n 73,\n 92,\n 100\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Percentage Of Drivers Involved In Fatal Collisions Who Had Not Been Involved In Any Previous Accidents\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 10,\n \"min\": 78,\n \"max\": 100,\n \"num_unique_values\": 5,\n \"samples\": [\n 98,\n 94,\n 100\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Car Insurance Premiums ($)\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 55.99742404789702,\n \"min\": 1160.13,\n \"max\": 1301.52,\n \"num_unique_values\": 5,\n \"samples\": [\n 1281.55,\n 1160.13,\n 1273.89\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Losses incurred by insurance companies for collisions per insured driver ($)\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 22.844925694779572,\n \"min\": 136.05,\n \"max\": 194.78,\n \"num_unique_values\": 5,\n \"samples\": [\n 194.78,\n 144.18,\n 136.05\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Risk\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 5.762638284674824,\n \"min\": 5.9,\n \"max\": 20.5,\n \"num_unique_values\": 5,\n \"samples\": [\n 20.5,\n 17.9,\n 5.9\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n },\n {\n \"column\": \"Price\",\n \"properties\": {\n \"dtype\": \"number\",\n \"std\": 55.99742404789702,\n \"min\": 1160.13,\n \"max\": 1301.52,\n \"num_unique_values\": 5,\n \"samples\": [\n 1281.55,\n 1160.13,\n 1273.89\n ],\n \"semantic_type\": \"\",\n \"description\": \"\"\n }\n }\n ]\n}" + } + }, + "metadata": {}, + "execution_count": 6 + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "### Risk vs Price Mismatch\n", + "\n", + "States with the highest fatal crash rates (North Dakota, South Carolina, West Virginia)\n", + "have relatively low insurance premiums, while safer states like DC and New Jersey\n", + "pay some of the highest premiums.\n", + "\n", + "This indicates that insurance pricing across states does not closely follow actual\n", + "road safety risk.\n" + ], + "metadata": { + "id": "NRbblDU_OtFB" + } + } + ] +} \ No newline at end of file