From 640202a52928d5af53745200261c43f95a56252c Mon Sep 17 00:00:00 2001 From: Marc Greenlee Date: Sun, 3 Nov 2024 22:10:41 +0100 Subject: [PATCH] solved lab --- ...a-cleaning-and-formatting-checkpoint.ipynb | 2188 ++++++++++++++ cleaned_insurance_comp_data_lab2.csv | 953 +++++++ lab-dw-data-cleaning-and-formatting.ipynb | 2513 ++++++++++++++--- 3 files changed, 5306 insertions(+), 348 deletions(-) create mode 100644 .ipynb_checkpoints/lab-dw-data-cleaning-and-formatting-checkpoint.ipynb create mode 100644 cleaned_insurance_comp_data_lab2.csv diff --git a/.ipynb_checkpoints/lab-dw-data-cleaning-and-formatting-checkpoint.ipynb b/.ipynb_checkpoints/lab-dw-data-cleaning-and-formatting-checkpoint.ipynb new file mode 100644 index 0000000..b9461a5 --- /dev/null +++ b/.ipynb_checkpoints/lab-dw-data-cleaning-and-formatting-checkpoint.ipynb @@ -0,0 +1,2188 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "25d7736c-ba17-4aff-b6bb-66eba20fbf4e", + "metadata": { + "id": "25d7736c-ba17-4aff-b6bb-66eba20fbf4e" + }, + "source": [ + "# Lab | Data Cleaning and Formatting" + ] + }, + { + "cell_type": "markdown", + "id": "d1973e9e-8be6-4039-b70e-d73ee0d94c99", + "metadata": { + "id": "d1973e9e-8be6-4039-b70e-d73ee0d94c99" + }, + "source": [ + "In this lab, we will be working with the customer data from an insurance company, which can be found in the CSV file located at the following link: https://raw.githubusercontent.com/data-bootcamp-v4/data/main/file1.csv\n" + ] + }, + { + "cell_type": "markdown", + "id": "31b8a9e7-7db9-4604-991b-ef6771603e57", + "metadata": { + "id": "31b8a9e7-7db9-4604-991b-ef6771603e57" + }, + "source": [ + "# Challenge 1: Data Cleaning and Formatting" + ] + }, + { + "cell_type": "markdown", + "id": "81553f19-9f2c-484b-8940-520aff884022", + "metadata": { + "id": "81553f19-9f2c-484b-8940-520aff884022" + }, + "source": [ + "## Exercise 1: Cleaning Column Names" + ] + }, + { + "cell_type": "markdown", + "id": "34a929f4-1be4-4fa8-adda-42ffd920be90", + "metadata": { + "id": "34a929f4-1be4-4fa8-adda-42ffd920be90" + }, + "source": [ + "To ensure consistency and ease of use, standardize the column names of the dataframe. Start by taking a first look at the dataframe and identifying any column names that need to be modified. Use appropriate naming conventions and make sure that column names are descriptive and informative.\n", + "\n", + "*Hint*:\n", + "- *Column names should be in lower case*\n", + "- *White spaces in column names should be replaced by `_`*\n", + "- *`st` could be replaced for `state`*" + ] + }, + { + "cell_type": "code", + "execution_count": 131, + "id": "5810735c-8056-4442-bbf2-dda38d3e284a", + "metadata": { + "id": "5810735c-8056-4442-bbf2-dda38d3e284a" + }, + "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", + "
customerstategendereducationcustomer_lifetime_valueincomemonthly_premium_autonumber_of_open_complaintspolicy_typevehicle_classtotal_claim_amount
0RB50392WashingtonNaNMasterNaN0.01000.01/0/00Personal AutoFour-Door Car2.704934
1QZ44356ArizonaFBachelor697953.59%0.094.01/0/00Personal AutoFour-Door Car1131.464935
2AI49188NevadaFBachelor1288743.17%48767.0108.01/0/00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniaMBachelor764586.18%0.0106.01/0/00Corporate AutoSUV529.881344
4GA49547WashingtonMHigh School or Below536307.65%36357.068.01/0/00Personal AutoFour-Door Car17.269323
....................................
4003NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4004NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4005NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4006NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4007NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", + "

4008 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education \\\n", + "0 RB50392 Washington NaN Master \n", + "1 QZ44356 Arizona F Bachelor \n", + "2 AI49188 Nevada F Bachelor \n", + "3 WW63253 California M Bachelor \n", + "4 GA49547 Washington M High School or Below \n", + "... ... ... ... ... \n", + "4003 NaN NaN NaN NaN \n", + "4004 NaN NaN NaN NaN \n", + "4005 NaN NaN NaN NaN \n", + "4006 NaN NaN NaN NaN \n", + "4007 NaN NaN NaN NaN \n", + "\n", + " customer_lifetime_value income monthly_premium_auto \\\n", + "0 NaN 0.0 1000.0 \n", + "1 697953.59% 0.0 94.0 \n", + "2 1288743.17% 48767.0 108.0 \n", + "3 764586.18% 0.0 106.0 \n", + "4 536307.65% 36357.0 68.0 \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " number_of_open_complaints policy_type vehicle_class \\\n", + "0 1/0/00 Personal Auto Four-Door Car \n", + "1 1/0/00 Personal Auto Four-Door Car \n", + "2 1/0/00 Personal Auto Two-Door Car \n", + "3 1/0/00 Corporate Auto SUV \n", + "4 1/0/00 Personal Auto Four-Door Car \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " total_claim_amount \n", + "0 2.704934 \n", + "1 1131.464935 \n", + "2 566.472247 \n", + "3 529.881344 \n", + "4 17.269323 \n", + "... ... \n", + "4003 NaN \n", + "4004 NaN \n", + "4005 NaN \n", + "4006 NaN \n", + "4007 NaN \n", + "\n", + "[4008 rows x 11 columns]" + ] + }, + "execution_count": 131, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "url = \"https://raw.githubusercontent.com/data-bootcamp-v4/data/main/file1.csv\"\n", + "\n", + "import pandas as pd\n", + "df = pd.read_csv(url)\n", + "\n", + "def clean_columns(df):\n", + " df.columns = (\n", + " df.columns\n", + " .str.lower()\n", + " .str.replace(\" \",\"_\")\n", + " \n", + " )\n", + "\n", + " return df\n", + "df = clean_columns(df)\n", + "\n", + "df.rename(columns= {'st': 'state'}, inplace = True)\n", + "\n", + "df\n", + " " + ] + }, + { + "cell_type": "markdown", + "id": "9cb501ec-36ff-4589-b872-6252bb150316", + "metadata": { + "id": "9cb501ec-36ff-4589-b872-6252bb150316" + }, + "source": [ + "## Exercise 2: Cleaning invalid Values" + ] + }, + { + "cell_type": "markdown", + "id": "771fdcf3-8e20-4b06-9c24-3a93ba2b0909", + "metadata": { + "id": "771fdcf3-8e20-4b06-9c24-3a93ba2b0909" + }, + "source": [ + "The dataset contains columns with inconsistent and incorrect values that could affect the accuracy of our analysis. Therefore, we need to clean these columns to ensure that they only contain valid data.\n", + "\n", + "Note that this exercise will focus only on cleaning inconsistent values and will not involve handling null values (NaN or None).\n", + "\n", + "*Hint*:\n", + "- *Gender column contains various inconsistent values such as \"F\", \"M\", \"Femal\", \"Male\", \"female\", which need to be standardized, for example, to \"M\" and \"F\".*\n", + "- *State abbreviations be can replaced with its full name, for example \"AZ\": \"Arizona\", \"Cali\": \"California\", \"WA\": \"Washington\"*\n", + "- *In education, \"Bachelors\" could be replaced by \"Bachelor\"*\n", + "- *In Customer Lifetime Value, delete the `%` character*\n", + "- *In vehicle class, \"Sports Car\", \"Luxury SUV\" and \"Luxury Car\" could be replaced by \"Luxury\"*" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "d2a1c74f-e3e2-43db-bcdf-50ff88369d92", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Washington', 'Arizona', 'Nevada', 'California', 'Oregon', 'Cali',\n", + " 'AZ', 'WA', nan], dtype=object)" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['state'].unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "3f8ee5cb-50ab-48af-8a9f-9a389804033c", + "metadata": { + "id": "3f8ee5cb-50ab-48af-8a9f-9a389804033c" + }, + "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", + "
customerstategendereducationcustomer_lifetime_valueincomemonthly_premium_autonumber_of_open_complaintspolicy_typevehicle_classtotal_claim_amount
0RB50392WashingtonNaNMasterNaN0.01000.01/0/00Personal AutoFour-Door Car2.704934
1QZ44356ArizonafemaleBachelor697953.59%0.094.01/0/00Personal AutoFour-Door Car1131.464935
2AI49188NevadafemaleBachelor1288743.17%48767.0108.01/0/00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniamaleBachelor764586.18%0.0106.01/0/00Corporate AutoSUV529.881344
4GA49547WashingtonmaleHigh School or Below536307.65%36357.068.01/0/00Personal AutoFour-Door Car17.269323
....................................
4003NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4004NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4005NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4006NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4007NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", + "

4008 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education \\\n", + "0 RB50392 Washington NaN Master \n", + "1 QZ44356 Arizona female Bachelor \n", + "2 AI49188 Nevada female Bachelor \n", + "3 WW63253 California male Bachelor \n", + "4 GA49547 Washington male High School or Below \n", + "... ... ... ... ... \n", + "4003 NaN NaN NaN NaN \n", + "4004 NaN NaN NaN NaN \n", + "4005 NaN NaN NaN NaN \n", + "4006 NaN NaN NaN NaN \n", + "4007 NaN NaN NaN NaN \n", + "\n", + " customer_lifetime_value income monthly_premium_auto \\\n", + "0 NaN 0.0 1000.0 \n", + "1 697953.59% 0.0 94.0 \n", + "2 1288743.17% 48767.0 108.0 \n", + "3 764586.18% 0.0 106.0 \n", + "4 536307.65% 36357.0 68.0 \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " number_of_open_complaints policy_type vehicle_class \\\n", + "0 1/0/00 Personal Auto Four-Door Car \n", + "1 1/0/00 Personal Auto Four-Door Car \n", + "2 1/0/00 Personal Auto Two-Door Car \n", + "3 1/0/00 Corporate Auto SUV \n", + "4 1/0/00 Personal Auto Four-Door Car \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " total_claim_amount \n", + "0 2.704934 \n", + "1 1131.464935 \n", + "2 566.472247 \n", + "3 529.881344 \n", + "4 17.269323 \n", + "... ... \n", + "4003 NaN \n", + "4004 NaN \n", + "4005 NaN \n", + "4006 NaN \n", + "4007 NaN \n", + "\n", + "[4008 rows x 11 columns]" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['gender'] = df['gender'].apply( lambda x: ('male' if x[0].lower() == 'm' else 'female') if isinstance(x, str) else x)\n", + "df" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "f3de77fa-38c6-40d8-a7be-2ec662b03832", + "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", + "
customerstategendereducationcustomer_lifetime_valueincomemonthly_premium_autonumber_of_open_complaintspolicy_typevehicle_classtotal_claim_amount
0RB50392WashingtonNaNMasterNaN0.01000.01/0/00Personal AutoFour-Door Car2.704934
1QZ44356ArizonafemaleBachelor697953.59%0.094.01/0/00Personal AutoFour-Door Car1131.464935
2AI49188NevadafemaleBachelor1288743.17%48767.0108.01/0/00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniamaleBachelor764586.18%0.0106.01/0/00Corporate AutoSUV529.881344
4GA49547WashingtonmaleHigh School or Below536307.65%36357.068.01/0/00Personal AutoFour-Door Car17.269323
....................................
4003NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4004NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4005NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4006NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4007NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", + "

4008 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education \\\n", + "0 RB50392 Washington NaN Master \n", + "1 QZ44356 Arizona female Bachelor \n", + "2 AI49188 Nevada female Bachelor \n", + "3 WW63253 California male Bachelor \n", + "4 GA49547 Washington male High School or Below \n", + "... ... ... ... ... \n", + "4003 NaN NaN NaN NaN \n", + "4004 NaN NaN NaN NaN \n", + "4005 NaN NaN NaN NaN \n", + "4006 NaN NaN NaN NaN \n", + "4007 NaN NaN NaN NaN \n", + "\n", + " customer_lifetime_value income monthly_premium_auto \\\n", + "0 NaN 0.0 1000.0 \n", + "1 697953.59% 0.0 94.0 \n", + "2 1288743.17% 48767.0 108.0 \n", + "3 764586.18% 0.0 106.0 \n", + "4 536307.65% 36357.0 68.0 \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " number_of_open_complaints policy_type vehicle_class \\\n", + "0 1/0/00 Personal Auto Four-Door Car \n", + "1 1/0/00 Personal Auto Four-Door Car \n", + "2 1/0/00 Personal Auto Two-Door Car \n", + "3 1/0/00 Corporate Auto SUV \n", + "4 1/0/00 Personal Auto Four-Door Car \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " total_claim_amount \n", + "0 2.704934 \n", + "1 1131.464935 \n", + "2 566.472247 \n", + "3 529.881344 \n", + "4 17.269323 \n", + "... ... \n", + "4003 NaN \n", + "4004 NaN \n", + "4005 NaN \n", + "4006 NaN \n", + "4007 NaN \n", + "\n", + "[4008 rows x 11 columns]" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "def replace_st_abbreviations(state):\n", + " \n", + " if state == 'Cali':\n", + " return 'California'\n", + " elif state == 'AZ':\n", + " return 'Arizona'\n", + " elif state == 'WA':\n", + " return 'Washington'\n", + " else:\n", + " return state\n", + "\n", + "df['state'] = df['state'].apply(replace_st_abbreviations)\n", + "\n", + "df\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "d6dd0313-0293-4b3e-87c0-e318083b9ee8", + "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", + "
customerstategendereducationcustomer_lifetime_valueincomemonthly_premium_autonumber_of_open_complaintspolicy_typevehicle_classtotal_claim_amount
0RB50392WashingtonNaNMasterNaN0.01000.01/0/00Personal AutoFour-Door Car2.704934
1QZ44356ArizonafemaleBachelor697953.59%0.094.01/0/00Personal AutoFour-Door Car1131.464935
2AI49188NevadafemaleBachelor1288743.17%48767.0108.01/0/00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniamaleBachelor764586.18%0.0106.01/0/00Corporate AutoSUV529.881344
4GA49547WashingtonmaleHigh School or Below536307.65%36357.068.01/0/00Personal AutoFour-Door Car17.269323
....................................
4003NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4004NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4005NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4006NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4007NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", + "

4008 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education \\\n", + "0 RB50392 Washington NaN Master \n", + "1 QZ44356 Arizona female Bachelor \n", + "2 AI49188 Nevada female Bachelor \n", + "3 WW63253 California male Bachelor \n", + "4 GA49547 Washington male High School or Below \n", + "... ... ... ... ... \n", + "4003 NaN NaN NaN NaN \n", + "4004 NaN NaN NaN NaN \n", + "4005 NaN NaN NaN NaN \n", + "4006 NaN NaN NaN NaN \n", + "4007 NaN NaN NaN NaN \n", + "\n", + " customer_lifetime_value income monthly_premium_auto \\\n", + "0 NaN 0.0 1000.0 \n", + "1 697953.59% 0.0 94.0 \n", + "2 1288743.17% 48767.0 108.0 \n", + "3 764586.18% 0.0 106.0 \n", + "4 536307.65% 36357.0 68.0 \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " number_of_open_complaints policy_type vehicle_class \\\n", + "0 1/0/00 Personal Auto Four-Door Car \n", + "1 1/0/00 Personal Auto Four-Door Car \n", + "2 1/0/00 Personal Auto Two-Door Car \n", + "3 1/0/00 Corporate Auto SUV \n", + "4 1/0/00 Personal Auto Four-Door Car \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " total_claim_amount \n", + "0 2.704934 \n", + "1 1131.464935 \n", + "2 566.472247 \n", + "3 529.881344 \n", + "4 17.269323 \n", + "... ... \n", + "4003 NaN \n", + "4004 NaN \n", + "4005 NaN \n", + "4006 NaN \n", + "4007 NaN \n", + "\n", + "[4008 rows x 11 columns]" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['education'] = df['education'].apply( lambda x: 'Bachelor' if x == 'Bachelors' else x)\n", + "\n", + "df" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "ade742f6-5637-4c67-b48d-61bec5455b6a", + "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", + "
customerstategendereducationcustomer_lifetime_valueincomemonthly_premium_autonumber_of_open_complaintspolicy_typevehicle_classtotal_claim_amount
0RB50392WashingtonNaNMasterNaN0.01000.01/0/00Personal AutoFour-Door Car2.704934
1QZ44356ArizonafemaleBachelor697953.590.094.01/0/00Personal AutoFour-Door Car1131.464935
2AI49188NevadafemaleBachelor1288743.1748767.0108.01/0/00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniamaleBachelor764586.180.0106.01/0/00Corporate AutoSUV529.881344
4GA49547WashingtonmaleHigh School or Below536307.6536357.068.01/0/00Personal AutoFour-Door Car17.269323
....................................
4003NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4004NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4005NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4006NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4007NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", + "

4008 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education \\\n", + "0 RB50392 Washington NaN Master \n", + "1 QZ44356 Arizona female Bachelor \n", + "2 AI49188 Nevada female Bachelor \n", + "3 WW63253 California male Bachelor \n", + "4 GA49547 Washington male High School or Below \n", + "... ... ... ... ... \n", + "4003 NaN NaN NaN NaN \n", + "4004 NaN NaN NaN NaN \n", + "4005 NaN NaN NaN NaN \n", + "4006 NaN NaN NaN NaN \n", + "4007 NaN NaN NaN NaN \n", + "\n", + " customer_lifetime_value income monthly_premium_auto \\\n", + "0 NaN 0.0 1000.0 \n", + "1 697953.59 0.0 94.0 \n", + "2 1288743.17 48767.0 108.0 \n", + "3 764586.18 0.0 106.0 \n", + "4 536307.65 36357.0 68.0 \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " number_of_open_complaints policy_type vehicle_class \\\n", + "0 1/0/00 Personal Auto Four-Door Car \n", + "1 1/0/00 Personal Auto Four-Door Car \n", + "2 1/0/00 Personal Auto Two-Door Car \n", + "3 1/0/00 Corporate Auto SUV \n", + "4 1/0/00 Personal Auto Four-Door Car \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " total_claim_amount \n", + "0 2.704934 \n", + "1 1131.464935 \n", + "2 566.472247 \n", + "3 529.881344 \n", + "4 17.269323 \n", + "... ... \n", + "4003 NaN \n", + "4004 NaN \n", + "4005 NaN \n", + "4006 NaN \n", + "4007 NaN \n", + "\n", + "[4008 rows x 11 columns]" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['customer_lifetime_value'] = df['customer_lifetime_value'].str.replace(\"%\", \" \").astype(float)\n", + "df" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "8f432553-1a68-4801-9a26-c502a7025e57", + "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", + "
customerstategendereducationcustomer_lifetime_valueincomemonthly_premium_autonumber_of_open_complaintspolicy_typevehicle_classtotal_claim_amount
0RB50392WashingtonNaNMasterNaN0.01000.01/0/00Personal AutoFour-Door Car2.704934
1QZ44356ArizonafemaleBachelor697953.590.094.01/0/00Personal AutoFour-Door Car1131.464935
2AI49188NevadafemaleBachelor1288743.1748767.0108.01/0/00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniamaleBachelor764586.180.0106.01/0/00Corporate AutoSUV529.881344
4GA49547WashingtonmaleHigh School or Below536307.6536357.068.01/0/00Personal AutoFour-Door Car17.269323
\n", + "
" + ], + "text/plain": [ + " customer state gender education customer_lifetime_value \\\n", + "0 RB50392 Washington NaN Master NaN \n", + "1 QZ44356 Arizona female Bachelor 697953.59 \n", + "2 AI49188 Nevada female Bachelor 1288743.17 \n", + "3 WW63253 California male Bachelor 764586.18 \n", + "4 GA49547 Washington male High School or Below 536307.65 \n", + "\n", + " income monthly_premium_auto number_of_open_complaints policy_type \\\n", + "0 0.0 1000.0 1/0/00 Personal Auto \n", + "1 0.0 94.0 1/0/00 Personal Auto \n", + "2 48767.0 108.0 1/0/00 Personal Auto \n", + "3 0.0 106.0 1/0/00 Corporate Auto \n", + "4 36357.0 68.0 1/0/00 Personal Auto \n", + "\n", + " vehicle_class total_claim_amount \n", + "0 Four-Door Car 2.704934 \n", + "1 Four-Door Car 1131.464935 \n", + "2 Two-Door Car 566.472247 \n", + "3 SUV 529.881344 \n", + "4 Four-Door Car 17.269323 " + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['vehicle_class'] = df['vehicle_class'].apply (lambda x: 'Luxury' if x in [\"Sports Car\", \"Luxury SUV\", \"Luxury Car\"] else x)\n", + "df.head()" + ] + }, + { + "cell_type": "markdown", + "id": "85ff78ce-0174-4890-9db3-8048b7d7d2d0", + "metadata": { + "id": "85ff78ce-0174-4890-9db3-8048b7d7d2d0" + }, + "source": [ + "## Exercise 3: Formatting data types" + ] + }, + { + "cell_type": "markdown", + "id": "b91c2cf8-79a2-4baf-9f65-ff2fb22270bd", + "metadata": { + "id": "b91c2cf8-79a2-4baf-9f65-ff2fb22270bd" + }, + "source": [ + "The data types of many columns in the dataset appear to be incorrect. This could impact the accuracy of our analysis. To ensure accurate analysis, we need to correct the data types of these columns. Please update the data types of the columns as appropriate." + ] + }, + { + "cell_type": "markdown", + "id": "43e5d853-ff9e-43b2-9d92-aef2f78764f3", + "metadata": { + "id": "43e5d853-ff9e-43b2-9d92-aef2f78764f3" + }, + "source": [ + "It is important to note that this exercise does not involve handling null values (NaN or None)." + ] + }, + { + "cell_type": "markdown", + "id": "329ca691-9196-4419-8969-3596746237a1", + "metadata": { + "id": "329ca691-9196-4419-8969-3596746237a1" + }, + "source": [ + "*Hint*:\n", + "- *Customer lifetime value should be numeric*\n", + "- *Number of open complaints has an incorrect format. Look at the different values it takes with `unique()` and take the middle value. As an example, 1/5/00 should be 5. Number of open complaints is a string - remember you can use `split()` to deal with it and take the number you need. Finally, since it should be numeric, cast the column to be in its proper type.*" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "eb8f5991-73e9-405f-bf1c-6b7c589379a9", + "metadata": { + "id": "eb8f5991-73e9-405f-bf1c-6b7c589379a9" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['1/0/00' '1/2/00' '1/1/00' '1/3/00' '1/5/00' '1/4/00' nan]\n" + ] + }, + { + "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", + "
customerstategendereducationcustomer_lifetime_valueincomemonthly_premium_autonumber_of_open_complaintspolicy_typevehicle_classtotal_claim_amount
0RB50392WashingtonNaNMasterNaN0.01000.00Personal AutoFour-Door Car2.704934
1QZ44356ArizonafemaleBachelor697953.590.094.00Personal AutoFour-Door Car1131.464935
2AI49188NevadafemaleBachelor1288743.1748767.0108.00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniamaleBachelor764586.180.0106.00Corporate AutoSUV529.881344
4GA49547WashingtonmaleHigh School or Below536307.6536357.068.00Personal AutoFour-Door Car17.269323
....................................
4003NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4004NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4005NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4006NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4007NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", + "

4008 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education \\\n", + "0 RB50392 Washington NaN Master \n", + "1 QZ44356 Arizona female Bachelor \n", + "2 AI49188 Nevada female Bachelor \n", + "3 WW63253 California male Bachelor \n", + "4 GA49547 Washington male High School or Below \n", + "... ... ... ... ... \n", + "4003 NaN NaN NaN NaN \n", + "4004 NaN NaN NaN NaN \n", + "4005 NaN NaN NaN NaN \n", + "4006 NaN NaN NaN NaN \n", + "4007 NaN NaN NaN NaN \n", + "\n", + " customer_lifetime_value income monthly_premium_auto \\\n", + "0 NaN 0.0 1000.0 \n", + "1 697953.59 0.0 94.0 \n", + "2 1288743.17 48767.0 108.0 \n", + "3 764586.18 0.0 106.0 \n", + "4 536307.65 36357.0 68.0 \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " number_of_open_complaints policy_type vehicle_class \\\n", + "0 0 Personal Auto Four-Door Car \n", + "1 0 Personal Auto Four-Door Car \n", + "2 0 Personal Auto Two-Door Car \n", + "3 0 Corporate Auto SUV \n", + "4 0 Personal Auto Four-Door Car \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " total_claim_amount \n", + "0 2.704934 \n", + "1 1131.464935 \n", + "2 566.472247 \n", + "3 529.881344 \n", + "4 17.269323 \n", + "... ... \n", + "4003 NaN \n", + "4004 NaN \n", + "4005 NaN \n", + "4006 NaN \n", + "4007 NaN \n", + "\n", + "[4008 rows x 11 columns]" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['customer_lifetime_value'].astype(float)\n", + "df['number_of_open_complaints'] = df['number_of_open_complaints'].str.split('/').str[1]\n", + "df['number_of_open_complaints'].astype(float)\n", + "df" + ] + }, + { + "cell_type": "markdown", + "id": "14c52e28-2d0c-4dd2-8bd5-3476e34fadc1", + "metadata": { + "id": "14c52e28-2d0c-4dd2-8bd5-3476e34fadc1" + }, + "source": [ + "## Exercise 4: Dealing with Null values" + ] + }, + { + "cell_type": "markdown", + "id": "34b9a20f-7d32-4417-975e-1b4dfb0e16cd", + "metadata": { + "id": "34b9a20f-7d32-4417-975e-1b4dfb0e16cd" + }, + "source": [ + "Identify any columns with null or missing values. Identify how many null values each column has. You can use the `isnull()` function in pandas to find columns with null values.\n", + "\n", + "Decide on a strategy for handling the null values. There are several options, including:\n", + "\n", + "- Drop the rows or columns with null values\n", + "- Fill the null values with a specific value (such as the column mean or median for numerical variables, and mode for categorical variables)\n", + "- Fill the null values with the previous or next value in the column\n", + "- Fill the null values based on a more complex algorithm or model (note: we haven't covered this yet)\n", + "\n", + "Implement your chosen strategy to handle the null values. You can use the `fillna()` function in pandas to fill null values or `dropna()` function to drop null values.\n", + "\n", + "Verify that your strategy has successfully handled the null values. You can use the `isnull()` function again to check if there are still null values in the dataset.\n", + "\n", + "Remember to document your process and explain your reasoning for choosing a particular strategy for handling null values.\n", + "\n", + "After formatting data types, as a last step, convert all the numeric variables to integers." + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "id": "f184fc35-7831-4836-a0a5-e7f99e01b40e", + "metadata": { + "id": "f184fc35-7831-4836-a0a5-e7f99e01b40e" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Index: 952 entries, 1 to 1070\n", + "Data columns (total 11 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 customer 952 non-null object\n", + " 1 state 952 non-null object\n", + " 2 gender 952 non-null object\n", + " 3 education 952 non-null object\n", + " 4 customer_lifetime_value 952 non-null int64 \n", + " 5 income 952 non-null int64 \n", + " 6 monthly_premium_auto 952 non-null int64 \n", + " 7 number_of_open_complaints 952 non-null object\n", + " 8 policy_type 952 non-null object\n", + " 9 vehicle_class 952 non-null object\n", + " 10 total_claim_amount 952 non-null int64 \n", + "dtypes: int64(4), object(7)\n", + "memory usage: 89.2+ KB\n" + ] + } + ], + "source": [ + "#The strategy for handling null values here should be to drop all the rows and columns\n", + "#with null values, because filling those with other specific values would corrupt the \n", + "#information of other clients. We cannot add the number of open complaints\n", + "#of one customer to the next one on the list, for example. \n", + "\n", + "df.dropna(inplace=True)\n", + "\n", + "df.isnull()\n", + "\n", + "df[['total_claim_amount', 'monthly_premium_auto', 'income', 'customer_lifetime_value']] = df[['total_claim_amount', 'monthly_premium_auto', 'income', 'customer_lifetime_value']].astype(int)\n", + "df.info()" + ] + }, + { + "cell_type": "markdown", + "id": "98416351-e999-4156-9834-9b00a311adfa", + "metadata": { + "id": "98416351-e999-4156-9834-9b00a311adfa" + }, + "source": [ + "## Exercise 5: Dealing with duplicates" + ] + }, + { + "cell_type": "markdown", + "id": "ea0816a7-a18e-4d4c-b667-a8452a800bd1", + "metadata": { + "id": "ea0816a7-a18e-4d4c-b667-a8452a800bd1" + }, + "source": [ + "Use the `.duplicated()` method to identify any duplicate rows in the dataframe.\n", + "\n", + "Decide on a strategy for handling the duplicates. Options include:\n", + "- Dropping all duplicate rows\n", + "- Keeping only the first occurrence of each duplicated row\n", + "- Keeping only the last occurrence of each duplicated row\n", + "- Dropping duplicates based on a subset of columns\n", + "- Dropping duplicates based on a specific column\n", + "\n", + "Implement your chosen strategy using the `drop_duplicates()` function.\n", + "\n", + "Verify that your strategy has successfully handled the duplicates by checking for duplicates again using `.duplicated()`.\n", + "\n", + "Remember to document your process and explain your reasoning for choosing a particular strategy for handling duplicates.\n", + "\n", + "Save the cleaned dataset to a new CSV file.\n", + "\n", + "*Hint*: *after dropping duplicates, reset the index to ensure consistency*." + ] + }, + { + "cell_type": "code", + "execution_count": 114, + "id": "1929362c-47ed-47cb-baca-358b78d401a0", + "metadata": { + "id": "1929362c-47ed-47cb-baca-358b78d401a0" + }, + "outputs": [], + "source": [ + "#Dropping all the duplicate values is also the best strategy in this case, as each row has a unique identifier (customer(ID))\n", + "#and there is no value in keeping duplicate values, as it would contaminate our data stats.\n", + "\n", + "df.drop_duplicates()\n", + "\n", + "df.to_csv('cleaned_insurance_comp_data_lab2.csv', index=False)\n" + ] + }, + { + "cell_type": "markdown", + "id": "60840701-4783-40e2-b4d8-55303f9100c9", + "metadata": { + "id": "60840701-4783-40e2-b4d8-55303f9100c9" + }, + "source": [ + "# Bonus: Challenge 2: creating functions on a separate `py` file" + ] + }, + { + "cell_type": "markdown", + "id": "9d1adb3a-17cf-4899-8041-da21a4337fb4", + "metadata": { + "id": "9d1adb3a-17cf-4899-8041-da21a4337fb4" + }, + "source": [ + "Put all the data cleaning and formatting steps into functions, and create a main function that performs all the cleaning and formatting.\n", + "\n", + "Write these functions in separate .py file(s). By putting these steps into functions, we can make the code more modular and easier to maintain." + ] + }, + { + "cell_type": "markdown", + "id": "0e170dc2-b62c-417a-8248-e63ed18a70c4", + "metadata": { + "id": "0e170dc2-b62c-417a-8248-e63ed18a70c4" + }, + "source": [ + "*Hint: autoreload module is a utility module in Python that allows you to automatically reload modules in the current session when changes are made to the source code. This can be useful in situations where you are actively developing code and want to see the effects of changes you make without having to constantly restart the Python interpreter or Jupyter Notebook kernel.*" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "a52c6dfc-cd11-4d01-bda4-f719fa33e9a4", + "metadata": { + "id": "a52c6dfc-cd11-4d01-bda4-f719fa33e9a4" + }, + "outputs": [], + "source": [ + "# Your code here" + ] + }, + { + "cell_type": "markdown", + "id": "80f846bb-3f5e-4ca2-96c0-900728daca5a", + "metadata": { + "id": "80f846bb-3f5e-4ca2-96c0-900728daca5a", + "tags": [] + }, + "source": [ + "# Bonus: Challenge 3: Analyzing Clean and Formated Data" + ] + }, + { + "cell_type": "markdown", + "id": "9021630e-cc90-446c-b5bd-264d6c864207", + "metadata": { + "id": "9021630e-cc90-446c-b5bd-264d6c864207" + }, + "source": [ + "You have been tasked with analyzing the data to identify potential areas for improving customer retention and profitability. Your goal is to identify customers with a high policy claim amount and a low customer lifetime value.\n", + "\n", + "In the Pandas Lab, we only looked at high policy claim amounts because we couldn't look into low customer lifetime values. If we had tried to work with that column, we wouldn't have been able to because customer lifetime value wasn't clean and in its proper format. So after cleaning and formatting the data, let's get some more interesting insights!\n", + "\n", + "Instructions:\n", + "\n", + "- Review the statistics again for total claim amount and customer lifetime value to gain an understanding of the data.\n", + "- To identify potential areas for improving customer retention and profitability, we want to focus on customers with a high policy claim amount and a low customer lifetime value. Consider customers with a high policy claim amount to be those in the top 25% of the total claim amount, and clients with a low customer lifetime value to be those in the bottom 25% of the customer lifetime value. Create a pandas DataFrame object that contains information about customers with a policy claim amount greater than the 75th percentile and a customer lifetime value in the bottom 25th percentile.\n", + "- Use DataFrame methods to calculate summary statistics about the high policy claim amount and low customer lifetime value data. To do so, select both columns of the dataframe simultaneously and pass it to the `.describe()` method. This will give you descriptive statistics, such as mean, median, standard deviation, minimum and maximum values for both columns at the same time, allowing you to compare and analyze their characteristics." + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "211e82b5-461a-4d6f-8a23-4deccb84173c", + "metadata": { + "id": "211e82b5-461a-4d6f-8a23-4deccb84173c" + }, + "outputs": [], + "source": [ + "# Your code here" + ] + } + ], + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/cleaned_insurance_comp_data_lab2.csv b/cleaned_insurance_comp_data_lab2.csv new file mode 100644 index 0000000..16337b4 --- /dev/null +++ b/cleaned_insurance_comp_data_lab2.csv @@ -0,0 +1,953 @@ +customer,state,gender,education,customer_lifetime_value,income,monthly_premium_auto,number_of_open_complaints,policy_type,vehicle_class,total_claim_amount +QZ44356,Arizona,female,Bachelor,697953,0,94,0,Personal Auto,Four-Door Car,1131 +AI49188,Nevada,female,Bachelor,1288743,48767,108,0,Personal Auto,Two-Door Car,566 +WW63253,California,male,Bachelor,764586,0,106,0,Corporate Auto,SUV,529 +GA49547,Washington,male,High School or Below,536307,36357,68,0,Personal Auto,Four-Door Car,17 +OC83172,Oregon,female,Bachelor,825629,62902,69,0,Personal Auto,Two-Door Car,159 +XZ87318,Oregon,female,College,538089,55350,67,0,Corporate Auto,Four-Door Car,321 +CF85061,Arizona,male,Master,721610,0,101,0,Corporate Auto,Four-Door Car,363 +DY87989,Oregon,male,Bachelor,2412750,14072,71,0,Corporate Auto,Four-Door Car,511 +BQ94931,Oregon,female,College,738817,28812,93,0,Special Auto,Four-Door Car,425 +SX51350,California,male,College,473899,0,67,0,Personal Auto,Four-Door Car,482 +QK46697,Washington,male,Bachelor,617710,61040,79,1,Personal Auto,Two-Door Car,20 +HS14476,Washington,male,College,916206,29723,80,0,Personal Auto,Four-Door Car,20 +HD95276,Washington,female,College,473787,0,130,0,Personal Auto,SUV,23 +YD87931,Washington,male,Doctor,495165,46896,35354,1,Personal Auto,Four-Door Car,31 +NW21079,Washington,female,Master,487938,67163,61,2,Personal Auto,Two-Door Car,33 +YB66933,Washington,female,Bachelor,538275,77552,68,1,Corporate Auto,Four-Door Car,45 +OW15518,Washington,female,College,1595001,0,87,1,Personal Auto,Two-Door Car,46 +GP39118,Washington,male,High School or Below,499655,71600,63,0,Personal Auto,Two-Door Car,46 +SG20925,Washington,female,Master,518579,99428,6464,1,Personal Auto,Four-Door Car,48 +FM14335,Washington,female,College,1048491,61108,89,0,Personal Auto,Four-Door Car,49 +HS28694,Washington,female,High School or Below,282986,25317,71,0,Personal Auto,Two-Door Car,50 +LH92841,Washington,female,Bachelor,725595,88891,89,0,Personal Auto,Four-Door Car,50 +AZ95587,Arizona,female,Bachelor,1038855,61222,89,0,Special Auto,Four-Door Car,392 +DS81757,Oregon,male,College,247012,0,74,0,Personal Auto,Two-Door Car,721 +OJ94107,Arizona,male,Master,561906,50335,140,0,Personal Auto,SUV,456 +LP84436,California,female,High School or Below,904711,0,127,0,Personal Auto,Luxury,1087 +FF22360,Washington,female,Doctor,268731,82210,68,4,Personal Auto,Four-Door Car,51 +LM19287,Oregon,female,High School or Below,373150,0,96,0,Personal Auto,Four-Door Car,460 +ZU18643,Nevada,male,Bachelor,366077,64495,92,0,Corporate Auto,Four-Door Car,251 +AZ82578,California,female,College,792882,0,72,0,Corporate Auto,Four-Door Car,345 +XC67861,Arizona,female,Bachelor,501175,28859,67,3,Corporate Auto,Two-Door Car,321 +YC43143,Arizona,female,High School or Below,798825,77330,99,0,Personal Auto,Four-Door Car,99 +EK59571,Oregon,male,College,388545,0,105,0,Corporate Auto,Four-Door Car,504 +PA38372,Washington,female,High School or Below,935773,33060,117,0,Personal Auto,Four-Door Car,56 +RO18530,Washington,male,Master,254068,42557,65,0,Personal Auto,Four-Door Car,57 +PD27940,Arizona,male,High School or Below,488516,26372,126,0,Personal Auto,SUV,604 +BS77946,Arizona,female,Bachelor,975330,17514,127,0,Personal Auto,SUV,8 +YM50253,California,female,Bachelor,294615,89270,74,0,Personal Auto,Four-Door Car,316 +NR15332,California,male,High School or Below,258111,29757,65,0,Personal Auto,Four-Door Car,312 +RC62865,Oregon,male,College,351738,51814,92,0,Personal Auto,Four-Door Car,56 +CC15295,Oregon,female,Bachelor,974335,24028,82,0,Personal Auto,Four-Door Car,393 +KA61892,Arizona,male,College,387364,28142,105,0,Personal Auto,Luxury,701 +OS94884,Arizona,female,Bachelor,764928,52705,64,1,Personal Auto,Two-Door Car,128 +ND87334,California,male,High School or Below,228759,0,63,0,Corporate Auto,Two-Door Car,679 +OY51402,Washington,female,High School or Below,825576,54040,103,0,Personal Auto,SUV,59 +YL74911,California,female,College,871492,0,118,0,Personal Auto,SUV,566 +GK92563,Washington,female,Doctor,681923,22492,85,0,Personal Auto,Two-Door Car,61 +HL53154,California,male,Bachelor,741619,0,77,2,Personal Auto,Four-Door Car,554 +RI78966,Oregon,male,Master,777115,21876,68,0,Personal Auto,Four-Door Car,465 +IC13702,California,female,Bachelor,696834,0,69,1,Personal Auto,Four-Door Car,496 +BE10809,California,female,High School or Below,425028,0,61,1,Personal Auto,Four-Door Car,292 +HT87217,Oregon,female,High School or Below,1977656,70699,82,0,Personal Auto,Four-Door Car,256 +TH95618,California,female,High School or Below,2134346,0,74,1,Personal Auto,Four-Door Car,355 +TS19868,California,male,College,241313,27501,63,0,Personal Auto,Four-Door Car,542 +LP45550,Oregon,female,Doctor,1536384,15897,101,0,Personal Auto,Four-Door Car,303 +QR87004,Nevada,female,College,845696,25141,73,1,Personal Auto,Four-Door Car,25 +OE75747,Nevada,female,College,218964,0,61,3,Personal Auto,Four-Door Car,292 +DX91392,California,male,High School or Below,578018,51066,74,0,Personal Auto,Four-Door Car,787 +AB72731,California,female,Bachelor,463998,28358,117,0,Personal Auto,Luxury,84 +GX84338,Washington,female,Doctor,382443,62530,95,0,Personal Auto,Four-Door Car,61 +IS12901,Arizona,female,Bachelor,596811,90972,74,0,Personal Auto,Two-Door Car,232 +BN90616,Washington,female,Bachelor,859033,63110,72,0,Personal Auto,Four-Door Car,68 +HH90090,California,female,Bachelor,407663,29549,104,0,Personal Auto,Luxury,710 +IU25463,California,female,Bachelor,1225260,0,115,1,Personal Auto,Four-Door Car,552 +KC11055,Nevada,female,Bachelor,1693627,39411,217,2,Personal Auto,Luxury,1122 +PD33979,Oregon,male,High School or Below,489243,21709,62,0,Personal Auto,Four-Door Car,408 +NK71023,Nevada,male,Bachelor,994230,67890,85,0,Personal Auto,Four-Door Car,408 +AB13432,California,male,Bachelor,373583,0,110,0,Personal Auto,SUV,792 +OZ97704,California,female,High School or Below,1311752,84311,111,4,Personal Auto,SUV,532 +UF46533,California,female,College,457452,99316,114,0,Corporate Auto,SUV,754 +XP47431,Arizona,female,Bachelor,547006,54507,138,0,Personal Auto,SUV,702 +GK73582,California,female,Bachelor,297884,64586,76,0,Personal Auto,Four-Door Car,206 +RV98763,Oregon,male,College,641096,61709,82,2,Personal Auto,Four-Door Car,275 +II62831,California,male,Master,447902,94656,111,1,Special Auto,SUV,459 +XK33449,California,female,High School or Below,238373,0,69,0,Special Auto,Two-Door Car,496 +TR85083,California,male,Bachelor,276449,61085,70,1,Personal Auto,Two-Door Car,336 +EO95328,Oregon,female,Bachelor,792010,89284,67,3,Personal Auto,Two-Door Car,321 +EN21086,Arizona,female,High School or Below,688909,0,63,0,Personal Auto,Four-Door Car,302 +YL83902,Washington,female,Bachelor,327419,31686,81,0,Personal Auto,Four-Door Car,430 +AZ62651,Oregon,male,High School or Below,995170,56855,255,0,Corporate Auto,Luxury,1836 +ZW25874,Oregon,male,Bachelor,252155,53703,67,2,Special Auto,Four-Door Car,67 +EH41854,Washington,female,High School or Below,2370611,0,96,1,Personal Auto,Two-Door Car,844 +MW70227,California,male,College,604702,20396,76,1,Personal Auto,Four-Door Car,364 +SL22297,California,female,Master,1114030,27679,150,0,Personal Auto,SUV,722 +RV14138,Nevada,female,Bachelor,433406,23904,123,3,Personal Auto,SUV,590 +UO62808,Arizona,female,High School or Below,279974,65351,69,0,Corporate Auto,Four-Door Car,481 +ZX64745,California,male,College,792313,0,113,0,Personal Auto,SUV,1124 +FL34139,California,male,High School or Below,368811,0,63,3,Personal Auto,Four-Door Car,669 +TS11219,California,male,College,1206745,0,116,0,Personal Auto,SUV,1284 +XX12304,California,female,College,292497,64459,72,0,Personal Auto,Four-Door Car,240 +SD64087,California,male,College,1501409,32961,190,0,Corporate Auto,SUV,912 +OY38576,Oregon,female,High School or Below,927723,71416,116,0,Corporate Auto,SUV,556 +BG76355,Washington,female,Bachelor,627412,68964,78,0,Personal Auto,Four-Door Car,115 +IP66913,California,male,High School or Below,388664,78108,98,0,Personal Auto,Two-Door Car,470 +LE95702,California,male,College,438627,10621,67,0,Special Auto,Four-Door Car,321 +KX54357,Washington,male,College,1136526,84910,95,0,Corporate Auto,Two-Door Car,383 +EZ78112,California,female,High School or Below,561096,77493,70,0,Special Auto,Four-Door Car,307 +XN16891,Arizona,male,College,291289,81097,74,0,Personal Auto,Four-Door Car,355 +XK31350,Oregon,female,College,691572,96610,85,0,Corporate Auto,Four-Door Car,520 +CC30924,Oregon,male,College,626266,30110,159,0,Corporate Auto,Luxury,466 +IT78748,Oregon,female,High School or Below,650339,22081,84,0,Special Auto,Two-Door Car,451 +KY33386,Washington,female,High School or Below,800739,0,112,0,Personal Auto,Luxury,537 +CO44221,California,male,College,292991,98473,72,0,Personal Auto,Four-Door Car,345 +LK60013,Oregon,female,Bachelor,596955,97431,74,0,Personal Auto,Four-Door Car,355 +DE21533,California,male,Bachelor,547315,93870,69,0,Personal Auto,Four-Door Car,331 +YS94121,Nevada,male,High School or Below,564539,50366,72,0,Personal Auto,Four-Door Car,428 +UK68427,Washington,male,High School or Below,636926,34498,83,0,Personal Auto,Two-Door Car,398 +TE49565,Oregon,female,College,1183376,16552,103,0,Personal Auto,SUV,494 +RA88421,Oregon,female,College,612110,26787,77,0,Personal Auto,Four-Door Car,369 +KQ51983,Nevada,male,College,515936,0,74,0,Personal Auto,Two-Door Car,831 +CD88896,Nevada,female,High School or Below,251459,43860,65,0,Corporate Auto,Four-Door Car,156 +YV22553,Arizona,male,High School or Below,866861,21474,114,2,Corporate Auto,SUV,373 +WU14435,California,male,Bachelor,496096,18174,66,0,Corporate Auto,Four-Door Car,395 +XV84099,Arizona,female,Bachelor,550413,0,73,0,Corporate Auto,Four-Door Car,350 +RI24911,Arizona,male,College,750745,60920,64,0,Personal Auto,Two-Door Car,231 +KO26461,Arizona,male,High School or Below,3226985,41520,90,0,Personal Auto,Four-Door Car,289 +HI14283,Oregon,female,Bachelor,565703,0,152,0,Personal Auto,SUV,729 +PT50227,Arizona,male,High School or Below,506175,0,68,0,Personal Auto,Two-Door Car,326 +BH36570,California,male,Bachelor,591278,72208,73,0,Personal Auto,Two-Door Car,350 +TX17484,California,female,Bachelor,1518227,53863,63,0,Personal Auto,Four-Door Car,105 +CT41158,Washington,male,College,1074703,66446,136,0,Corporate Auto,SUV,639 +AO87348,Washington,male,College,205062,0,61,0,Personal Auto,Four-Door Car,292 +DE55857,Washington,female,Bachelor,246544,64997,63,1,Personal Auto,Four-Door Car,383 +LF66923,Nevada,female,High School or Below,534312,64460,66,0,Corporate Auto,Two-Door Car,316 +CN24514,Arizona,female,College,811982,46618,67,0,Personal Auto,Four-Door Car,99 +UW32074,Oregon,female,College,460526,0,64,0,Corporate Auto,Four-Door Car,307 +HP36979,California,male,College,640878,49988,84,5,Personal Auto,Two-Door Car,566 +PP40919,California,female,College,237653,0,91,5,Personal Auto,Two-Door Car,436 +RO73268,California,male,Bachelor,321107,16269,86,0,Corporate Auto,Two-Door Car,412 +HO61691,Arizona,female,Bachelor,509452,72006,64,0,Personal Auto,Four-Door Car,307 +BS13062,Arizona,female,High School or Below,2575527,0,81,2,Personal Auto,Four-Door Car,388 +FO35655,Oregon,male,Bachelor,867222,0,245,0,Corporate Auto,Luxury,2345 +HR10526,California,male,Master,804473,44320,67,0,Personal Auto,Four-Door Car,321 +IA63417,Arizona,female,High School or Below,400151,19782,108,0,Personal Auto,Two-Door Car,773 +BH35016,Nevada,female,Bachelor,1670611,63933,70,0,Personal Auto,Two-Door Car,424 +PK52952,Arizona,male,Doctor,854441,28224,109,0,Personal Auto,SUV,523 +OD76309,Washington,female,College,780531,21073,106,1,Personal Auto,SUV,508 +IL28481,Oregon,male,Bachelor,611275,63243,77,0,Personal Auto,Four-Door Car,364 +GY55092,Nevada,male,High School or Below,477294,20993,133,0,Personal Auto,SUV,638 +UF33451,Oregon,female,Bachelor,1097909,94827,135,0,Personal Auto,SUV,354 +CF15558,California,female,Master,500426,39161,63,1,Personal Auto,Two-Door Car,283 +JM62924,Washington,male,Bachelor,1322304,37534,84,2,Personal Auto,Four-Door Car,403 +EM66435,Oregon,female,Bachelor,262331,80210,65,0,Corporate Auto,Four-Door Car,20 +QX45933,California,male,Bachelor,1784019,0,62,0,Personal Auto,Four-Door Car,385 +JI71369,California,female,College,510611,30110,64,0,Personal Auto,Four-Door Car,140 +JU93290,Arizona,female,College,1793060,21708,68,0,Personal Auto,Four-Door Car,326 +GU66096,Arizona,male,High School or Below,545734,94731,67,0,Personal Auto,Four-Door Car,321 +UC33108,California,male,Bachelor,656364,32375,83,0,Personal Auto,Four-Door Car,398 +LW93867,Oregon,male,College,481252,16531,63,0,Corporate Auto,Four-Door Car,102 +OU78470,Arizona,female,Master,2932804,32006,94,0,Corporate Auto,Four-Door Car,56 +XW90265,Arizona,female,Bachelor,577352,81676,72,0,Personal Auto,Two-Door Car,463 +HS67749,California,male,College,684711,71038,86,0,Corporate Auto,Four-Door Car,205 +VZ51506,Arizona,female,High School or Below,359531,0,103,0,Corporate Auto,Luxury,741 +UI64281,Nevada,female,Master,2285561,20832,65,0,Personal Auto,Two-Door Car,56 +AE98193,Washington,male,High School or Below,785941,0,113,0,Personal Auto,SUV,813 +AZ74055,Oregon,male,High School or Below,411557,52405,103,0,Personal Auto,Four-Door Car,494 +XS76911,Arizona,female,High School or Below,502963,0,133,0,Personal Auto,Luxury,795 +AY40674,Washington,female,Bachelor,482141,26583,1005,4,Personal Auto,SUV,614 +NA12740,Oregon,male,Master,500431,25486,65,0,Special Auto,Two-Door Car,72 +UA84837,Arizona,male,College,863005,24065,111,0,Corporate Auto,Four-Door Car,532 +DJ51510,Arizona,female,High School or Below,932208,70435,116,0,Personal Auto,Four-Door Car,67 +VM58985,California,male,College,1672756,0,76,2,Personal Auto,Two-Door Car,402 +OH60605,Oregon,female,High School or Below,365253,39679,92,0,Personal Auto,Two-Door Car,641 +UO98052,Nevada,male,College,615860,0,89,0,Personal Auto,Four-Door Car,342 +NC53424,California,male,Bachelor,437608,0,69,4,Personal Auto,Two-Door Car,331 +LQ13873,Nevada,male,High School or Below,556945,53565,71,1,Personal Auto,Four-Door Car,340 +LA97014,Washington,male,Bachelor,257651,37574,66,1,Personal Auto,Two-Door Car,412 +NB79936,Washington,male,Bachelor,834698,48259,108,0,Personal Auto,Two-Door Car,73 +NT89061,Arizona,female,High School or Below,632392,78532,78,0,Personal Auto,Four-Door Car,374 +AF10970,Arizona,female,Bachelor,597314,96163,73,0,Corporate Auto,Four-Door Car,350 +ZG48513,California,male,Bachelor,470667,0,72,0,Personal Auto,Four-Door Car,345 +JQ59145,California,male,High School or Below,809341,0,114,1,Personal Auto,Luxury,722 +FE84989,Washington,male,College,503574,72672,63,0,Personal Auto,Four-Door Car,259 +JT52858,Oregon,female,Bachelor,902786,99002,112,1,Personal Auto,Four-Door Car,537 +MC62068,California,male,High School or Below,728888,79494,91,0,Personal Auto,Four-Door Car,396 +EU27538,Oregon,male,Master,1804247,35704,225,0,Personal Auto,Luxury,358 +RH42306,Arizona,female,Bachelor,499206,0,71,0,Corporate Auto,Four-Door Car,653 +US23612,Oregon,female,High School or Below,910226,26049,118,0,Personal Auto,Two-Door Car,121 +WV76014,Arizona,male,Doctor,254040,70125,64,0,Special Auto,Four-Door Car,92 +RK96223,California,male,College,1294189,52369,110,1,Personal Auto,SUV,528 +MF82000,Washington,female,Bachelor,236534,0,66,2,Special Auto,Four-Door Car,159 +FM46980,Arizona,male,College,572076,41770,72,0,Personal Auto,Four-Door Car,476 +SY56792,Oregon,male,High School or Below,703553,0,101,0,Corporate Auto,Four-Door Car,727 +RF61565,California,male,College,263697,31911,67,0,Personal Auto,Four-Door Car,321 +IM94808,Nevada,male,Bachelor,539583,70051,68,0,Corporate Auto,Four-Door Car,42 +VI14730,Oregon,male,High School or Below,838263,19683,117,1,Personal Auto,Luxury,561 +YR34119,Washington,female,College,3116174,30916,112,0,Personal Auto,SUV,200 +RR77985,Oregon,female,Bachelor,288774,0,80,0,Personal Auto,Four-Door Car,676 +QD28391,Washington,male,College,742584,84302,62,0,Personal Auto,Four-Door Car,76 +WV17090,California,male,Bachelor,2558572,0,116,0,Corporate Auto,SUV,830 +TM23514,Oregon,male,College,1027260,60145,132,0,Personal Auto,SUV,580 +MQ68407,Oregon,female,Bachelor,437636,63774,111,0,Personal Auto,Four-Door Car,60 +GJ59592,California,female,Bachelor,531889,25134,67,0,Corporate Auto,Four-Door Car,321 +FY56083,Oregon,male,Bachelor,471976,37057,61,1,Personal Auto,Four-Door Car,47 +UA94723,Oregon,female,High School or Below,442803,58577,110,0,Personal Auto,SUV,303 +FW91032,California,male,High School or Below,587917,85857,73,0,Corporate Auto,Four-Door Car,100 +DE34457,Oregon,female,Doctor,941690,70602,116,0,Personal Auto,SUV,481 +HD32044,Oregon,female,Master,828815,33816,106,2,Corporate Auto,Four-Door Car,508 +HH30454,Oregon,male,Bachelor,3265483,0,153,0,Personal Auto,SUV,1101 +AH84063,Oregon,female,College,471945,89642,121,4,Corporate Auto,SUV,86 +QA17596,California,female,Bachelor,390347,60068,98,0,Personal Auto,Two-Door Car,470 +XI41052,California,female,Bachelor,545725,50044,139,0,Personal Auto,SUV,667 +DI30528,California,female,Master,272535,36650,69,1,Personal Auto,Four-Door Car,56 +SC66359,Arizona,female,College,443397,50653,110,0,Corporate Auto,SUV,262 +EN61670,Arizona,female,Doctor,533246,68931,66,0,Personal Auto,Four-Door Car,309 +DQ10761,Oregon,male,Bachelor,231509,0,73,1,Corporate Auto,Four-Door Car,350 +BQ51587,California,female,College,541195,0,73,0,Personal Auto,Four-Door Car,365 +JE21522,California,male,Bachelor,958733,39266,80,0,Personal Auto,Four-Door Car,384 +WS47147,California,male,College,2210350,0,102,0,Personal Auto,SUV,489 +ZA64638,Nevada,female,High School or Below,976494,0,98,1,Personal Auto,Four-Door Car,705 +EW38459,Nevada,female,Bachelor,256715,40864,65,0,Corporate Auto,Four-Door Car,9 +QW87316,Oregon,female,College,265062,39035,68,0,Personal Auto,Four-Door Car,244 +IC43478,California,male,Bachelor,1126436,34923,98,0,Personal Auto,Two-Door Car,639 +TE34064,California,male,High School or Below,216852,0,63,0,Personal Auto,Four-Door Car,453 +WU60905,California,female,High School or Below,861066,0,111,0,Corporate Auto,SUV,532 +YM18992,California,female,College,283464,24506,71,0,Personal Auto,Two-Door Car,511 +PD55753,Oregon,male,High School or Below,893013,0,82,0,Personal Auto,Four-Door Car,554 +KU56006,Arizona,female,College,553638,52220,70,1,Personal Auto,Four-Door Car,336 +MJ69973,Arizona,male,High School or Below,284085,0,74,0,Personal Auto,Two-Door Car,402 +TW43626,California,male,College,808288,53554,67,0,Personal Auto,Four-Door Car,327 +XX84133,California,male,Bachelor,525473,34476,67,1,Corporate Auto,Four-Door Car,5 +ZW84453,Arizona,female,Bachelor,511623,0,70,0,Personal Auto,Four-Door Car,131 +HO29524,California,male,College,303464,68205,76,0,Personal Auto,Two-Door Car,99 +VE89726,California,female,High School or Below,802489,0,119,1,Personal Auto,SUV,856 +GE87503,California,male,High School or Below,1821114,53690,154,0,Personal Auto,SUV,739 +PX90263,Oregon,male,High School or Below,512156,0,72,0,Personal Auto,Four-Door Car,518 +NI17718,California,female,High School or Below,215017,0,61,0,Personal Auto,Four-Door Car,292 +FY32213,California,female,High School or Below,559538,74454,71,0,Personal Auto,Four-Door Car,340 +RZ13254,Nevada,female,Bachelor,756282,0,73,0,Personal Auto,Four-Door Car,350 +GN45013,Oregon,male,High School or Below,538585,29664,71,0,Personal Auto,Four-Door Car,340 +NM39588,Washington,female,Doctor,267805,72450,66,0,Corporate Auto,Four-Door Car,84 +KU84464,Nevada,female,Bachelor,942256,47272,79,3,Personal Auto,Four-Door Car,64 +YH43527,Oregon,female,College,360586,21585,92,0,Corporate Auto,Four-Door Car,441 +RO30676,California,female,College,776259,23827,106,2,Personal Auto,Four-Door Car,37 +QL59704,Arizona,female,College,2344490,69906,74,2,Corporate Auto,Four-Door Car,202 +QH19450,California,female,High School or Below,255817,0,72,0,Corporate Auto,Four-Door Car,345 +SA54664,Washington,male,Master,265438,73196,66,1,Personal Auto,Four-Door Car,85 +CI38330,Washington,male,Bachelor,254978,72217,6464,0,Personal Auto,Four-Door Car,91 +WB38524,California,male,High School or Below,296959,46131,74,0,Personal Auto,Two-Door Car,355 +CE56187,Oregon,female,Master,436312,54514,109,3,Personal Auto,SUV,286 +JL19416,California,female,High School or Below,588430,0,161,0,Personal Auto,SUV,1159 +JZ61422,Nevada,female,College,527219,96668,66,0,Personal Auto,Four-Door Car,316 +LA13377,California,male,Doctor,550989,78879,69,1,Personal Auto,Four-Door Car,466 +NC99948,Nevada,male,College,1631368,0,69,0,Personal Auto,Four-Door Car,331 +QD34785,Arizona,female,Bachelor,567805,0,76,0,Personal Auto,Four-Door Car,364 +RO26085,California,female,Bachelor,1210120,0,112,0,Personal Auto,Luxury,1252 +ES57969,Oregon,male,Bachelor,245357,29735,69,0,Personal Auto,Four-Door Car,331 +JK55587,California,male,High School or Below,507566,23082,65,0,Special Auto,Four-Door Car,312 +RN97635,Arizona,male,Bachelor,321497,53984,80,0,Corporate Auto,Four-Door Car,421 +BI76326,California,female,College,1227534,52135,156,0,Personal Auto,SUV,430 +JA34909,California,female,College,272221,17576,71,0,Corporate Auto,Four-Door Car,398 +OJ90342,Oregon,female,Bachelor,245744,29486,62,0,Personal Auto,Four-Door Car,7 +CM88932,Oregon,female,Master,355484,58557,88,0,Corporate Auto,Four-Door Car,55 +JJ97525,California,male,Bachelor,492954,25632,63,0,Personal Auto,Two-Door Car,351 +XV21647,California,female,High School or Below,803645,0,112,0,Personal Auto,Luxury,806 +MC83487,Arizona,male,Bachelor,427691,18768,68,3,Corporate Auto,Four-Door Car,647 +BL90769,California,female,Bachelor,3347334,33190,106,0,Personal Auto,SUV,508 +CR57148,Oregon,female,Master,596058,47945,74,0,Personal Auto,Two-Door Car,128 +CP85232,Arizona,male,College,4479546,58778,126,0,Special Auto,SUV,302 +YL74732,California,female,High School or Below,383211,15192,100,0,Personal Auto,SUV,480 +FG16766,California,female,Bachelor,683793,51859,171,0,Personal Auto,SUV,1003 +NV55438,Nevada,female,High School or Below,528526,23422,72,0,Personal Auto,Two-Door Car,518 +RM10880,California,female,College,309651,21604,79,0,Corporate Auto,Four-Door Car,379 +GL56175,Arizona,male,College,358971,79298,90,0,Personal Auto,Four-Door Car,244 +UK52289,Arizona,female,Bachelor,258240,76731,64,0,Special Auto,Four-Door Car,201 +OT85112,Washington,male,College,340391,38460,88,1,Personal Auto,Four-Door Car,91 +BC62782,Arizona,female,College,1357567,48534,115,1,Personal Auto,SUV,552 +TI19722,Washington,male,Doctor,343613,30817,88,0,Corporate Auto,Four-Door Car,91 +JP30654,Oregon,female,College,2868582,48412,104,0,Personal Auto,SUV,707 +UM45563,Washington,male,Bachelor,450267,68798,114,0,Personal Auto,SUV,92 +EN60878,Oregon,male,Bachelor,618311,23712,85,0,Personal Auto,Four-Door Car,376 +JF36291,California,male,College,387364,28142,105,0,Personal Auto,Luxury,701 +BK59444,California,female,Master,1892933,72196,68,0,Personal Auto,Four-Door Car,152 +MK70700,California,male,Master,555329,68197,69,0,Personal Auto,Four-Door Car,176 +IW71076,California,male,Bachelor,501125,75248,63,0,Corporate Auto,Four-Door Car,104 +AP98768,California,female,College,1044244,0,98,0,Personal Auto,Four-Door Car,941 +OM24164,Nevada,male,Bachelor,219961,0,65,1,Personal Auto,Two-Door Car,468 +HR85211,Washington,female,Master,512317,89879,63,0,Personal Auto,Two-Door Car,94 +VC87846,Oregon,male,High School or Below,748431,46998,96,0,Corporate Auto,Four-Door Car,460 +ZM92052,Oregon,male,Bachelor,261302,57099,67,0,Personal Auto,Two-Door Car,67 +ON73702,Arizona,female,Bachelor,908063,33897,114,0,Corporate Auto,SUV,539 +QQ90441,Nevada,female,High School or Below,1377097,59207,116,0,Personal Auto,Four-Door Car,556 +HU35721,Oregon,male,High School or Below,287682,40171,73,0,Personal Auto,Four-Door Car,350 +YP47665,Washington,male,Doctor,540891,80192,67,0,Personal Auto,Four-Door Car,95 +FU99476,Washington,male,High School or Below,677030,74422,85,1,Personal Auto,Four-Door Car,95 +AG85615,Oregon,male,College,2414387,0,87,0,Special Auto,Four-Door Car,626 +OY74069,Arizona,female,College,353805,0,67,5,Personal Auto,Four-Door Car,321 +DJ91267,Nevada,female,Bachelor,2909123,34226,244,0,Personal Auto,Luxury,494 +KB72438,California,female,High School or Below,1983420,65989,123,1,Personal Auto,SUV,115 +TR67616,Oregon,male,High School or Below,473136,30686,61,0,Corporate Auto,Four-Door Car,19 +GF65731,California,female,Master,3553784,0,113,0,Personal Auto,Luxury,799 +HB67642,Arizona,female,High School or Below,3461137,20090,109,0,Personal Auto,Luxury,523 +DP84567,California,male,High School or Below,2021630,0,183,0,Personal Auto,Luxury,878 +VV77534,Oregon,male,College,1397651,77094,176,0,Personal Auto,SUV,444 +GL67540,California,female,College,590408,97413,73,0,Personal Auto,Four-Door Car,268 +SV50502,Oregon,female,Master,559583,79189,69,0,Corporate Auto,Four-Door Car,331 +UK59698,California,female,High School or Below,229430,0,62,0,Personal Auto,Two-Door Car,297 +OA57352,Arizona,female,College,627391,18577,86,0,Personal Auto,Four-Door Car,412 +ZF84449,Oregon,female,College,372672,0,112,1,Special Auto,Luxury,806 +AX86150,Washington,male,High School or Below,265671,62777,67,0,Personal Auto,Two-Door Car,101 +HG39060,Oregon,male,Bachelor,511068,0,74,0,Corporate Auto,Four-Door Car,532 +EM29359,Nevada,male,College,712659,17483,183,0,Personal Auto,Luxury,1317 +SF57173,Oregon,male,Master,460163,84394,114,0,Personal Auto,SUV,691 +OT47603,Oregon,male,College,915523,0,127,0,Personal Auto,Luxury,804 +SW31412,Oregon,female,College,1480805,41440,62,1,Personal Auto,Four-Door Car,297 +JS36322,Arizona,male,High School or Below,890167,0,136,1,Personal Auto,Luxury,1090 +RE81445,Oregon,female,College,573459,98132,71,0,Personal Auto,Two-Door Car,50 +RM24280,Oregon,female,High School or Below,417769,0,112,0,Personal Auto,Four-Door Car,537 +LC25393,California,male,Bachelor,2777628,88220,230,0,Personal Auto,Luxury,151 +UX38930,Arizona,female,Master,1036434,58327,129,0,Personal Auto,SUV,347 +HD95496,Oregon,male,Master,785190,25950,66,0,Personal Auto,Two-Door Car,271 +RX24650,Oregon,male,High School or Below,477294,20993,133,0,Corporate Auto,SUV,638 +DW19309,Oregon,male,High School or Below,1422650,65726,177,0,Corporate Auto,SUV,849 +MT41386,Washington,male,Bachelor,287543,84768,72,0,Personal Auto,Two-Door Car,110 +WZ40465,Washington,female,Bachelor,504129,36234,63,0,Personal Auto,Four-Door Car,113 +DB42794,California,male,College,436293,58842,110,0,Personal Auto,Four-Door Car,528 +JB50798,Oregon,female,Master,962452,25629,124,2,Corporate Auto,Luxury,595 +IP69763,Washington,female,College,2191440,77311,181,0,Personal Auto,SUV,113 +TE35785,California,male,Doctor,694842,0,196,2,Personal Auto,Luxury,1337 +HX74855,Washington,male,High School or Below,247152,95697,61,0,Personal Auto,Two-Door Car,114 +QN65180,Oregon,female,Bachelor,2190391,22254,79,0,Personal Auto,Four-Door Car,125 +GE47180,Nevada,male,High School or Below,902882,65974,113,0,Personal Auto,Luxury,235 +VQ38776,Oregon,female,College,530375,0,76,0,Personal Auto,Four-Door Car,395 +BH86846,Washington,male,High School or Below,2070825,92079,65,1,Corporate Auto,Four-Door Car,114 +IN17648,Nevada,male,High School or Below,512376,0,74,0,Personal Auto,Two-Door Car,772 +DF95759,Oregon,male,College,949234,0,132,0,Personal Auto,SUV,633 +QG45324,Oregon,female,High School or Below,820486,0,73,0,Personal Auto,Four-Door Car,350 +MN61620,Arizona,female,College,987729,67752,131,4,Personal Auto,Luxury,168 +YH86390,California,female,Bachelor,481500,25398,64,0,Corporate Auto,Four-Door Car,307 +FY13480,California,male,High School or Below,627701,0,88,0,Personal Auto,Four-Door Car,633 +YH61661,California,male,High School or Below,826063,33321,105,0,Special Auto,SUV,504 +NL93182,Nevada,male,Bachelor,254945,0,78,0,Corporate Auto,Four-Door Car,845 +WE68644,Oregon,female,Bachelor,380392,20325,100,0,Personal Auto,Luxury,668 +EZ30498,Oregon,male,Bachelor,863540,13129,117,0,Personal Auto,SUV,700 +QY74517,Oregon,female,High School or Below,551055,0,73,0,Personal Auto,Four-Door Car,525 +NM88660,Nevada,male,Master,358588,49080,91,0,Corporate Auto,Four-Door Car,25 +MZ82036,Nevada,male,College,488925,42536,63,0,Personal Auto,Four-Door Car,375 +ID20929,Oregon,male,Bachelor,275694,29926,74,0,Corporate Auto,Four-Door Car,418 +EY50028,Nevada,male,Doctor,328954,0,86,0,Corporate Auto,Two-Door Car,398 +TT82373,California,female,Bachelor,1093717,21450,138,0,Personal Auto,Luxury,938 +OH64088,California,male,High School or Below,737556,33345,65,0,Corporate Auto,Four-Door Car,338 +SK97780,California,female,Bachelor,1011077,15752,90,0,Corporate Auto,Two-Door Car,339 +IO33050,Oregon,female,High School or Below,511941,40169,65,1,Personal Auto,Four-Door Car,302 +XA55917,California,female,College,853383,26049,113,1,Personal Auto,SUV,619 +JK32620,Nevada,male,College,222476,0,68,0,Personal Auto,Four-Door Car,326 +RQ19236,Arizona,male,Doctor,804280,55411,100,0,Personal Auto,Luxury,259 +QC47433,Oregon,male,College,255443,12459,70,0,Personal Auto,Four-Door Car,336 +RA93608,Oregon,male,Bachelor,1807394,64620,76,1,Personal Auto,Two-Door Car,364 +XH97711,California,male,Bachelor,243050,83140,61,0,Corporate Auto,Four-Door Car,179 +AU96286,Oregon,female,Bachelor,316765,0,92,0,Corporate Auto,Four-Door Car,662 +KC17170,Arizona,female,Bachelor,546560,54422,68,0,Corporate Auto,Four-Door Car,75 +ZN47335,California,male,College,1035751,68309,131,0,Corporate Auto,SUV,306 +EI46264,California,male,High School or Below,253781,56621,65,2,Personal Auto,Four-Door Car,84 +EK87864,Arizona,female,College,282194,38977,70,0,Special Auto,Four-Door Car,139 +GV45403,Arizona,male,Bachelor,775712,0,111,0,Corporate Auto,Two-Door Car,607 +QK31192,Arizona,male,High School or Below,407913,0,114,0,Corporate Auto,Two-Door Car,631 +LU89008,Arizona,female,College,595554,0,83,0,Personal Auto,Four-Door Car,628 +NS10490,Oregon,female,Bachelor,1415861,83235,70,0,Personal Auto,Two-Door Car,336 +KL98495,Nevada,male,College,848723,0,74,0,Personal Auto,Two-Door Car,426 +IU96845,Arizona,male,College,628547,32390,80,0,Personal Auto,Four-Door Car,91 +QL93655,Oregon,female,High School or Below,1147348,66538,95,0,Personal Auto,Two-Door Car,317 +PF40592,Washington,female,College,494263,23285,65,0,Personal Auto,Two-Door Car,118 +LZ34046,Oregon,male,Bachelor,2359468,76358,66,0,Personal Auto,Four-Door Car,86 +JC80093,Washington,male,Master,257250,21104,66,0,Personal Auto,Four-Door Car,118 +YE88490,Arizona,female,College,538089,55350,67,0,Personal Auto,Four-Door Car,321 +YC80498,California,female,College,477055,12964,65,0,Personal Auto,Two-Door Car,362 +AI85843,Arizona,female,Master,675665,33288,86,2,Personal Auto,Four-Door Car,221 +XD66024,Arizona,female,College,593601,0,84,0,Personal Auto,Four-Door Car,980 +FY51713,Arizona,female,Bachelor,357076,56168,88,0,Personal Auto,Four-Door Car,614 +PH26378,California,male,College,601996,0,92,0,Personal Auto,Four-Door Car,662 +WQ18638,Oregon,male,High School or Below,542686,23105,69,0,Personal Auto,Two-Door Car,331 +KY14688,Oregon,female,Master,273031,36218,68,0,Personal Auto,Four-Door Car,145 +TC97762,California,female,High School or Below,498268,52275,62,0,Corporate Auto,Four-Door Car,374 +QC87108,Oregon,female,College,876926,49665,74,0,Personal Auto,Four-Door Car,355 +CX12134,Nevada,male,High School or Below,422061,32471,110,0,Personal Auto,Two-Door Car,528 +SM73248,Arizona,male,High School or Below,1153750,0,86,1,Corporate Auto,Two-Door Car,619 +CK19789,California,female,Master,588718,62773,73,0,Personal Auto,Four-Door Car,80 +UV12583,California,female,College,470058,76694,117,0,Personal Auto,SUV,561 +JC11405,Oregon,male,High School or Below,1096395,55687,276,0,Personal Auto,Luxury,1324 +KA89683,Arizona,female,High School or Below,252317,0,70,0,Personal Auto,Four-Door Car,504 +BG85305,Nevada,male,Doctor,375780,36633,96,1,Personal Auto,Four-Door Car,460 +UQ87917,Oregon,male,High School or Below,1294173,77060,106,0,Personal Auto,SUV,468 +XN11823,Nevada,female,Bachelor,376446,92600,94,0,Corporate Auto,Two-Door Car,842 +OS46571,California,male,High School or Below,688955,0,66,0,Personal Auto,Four-Door Car,475 +PX17116,Nevada,male,College,362345,0,111,2,Corporate Auto,SUV,1171 +RP19541,Arizona,male,College,758211,64801,64,0,Personal Auto,Four-Door Car,268 +ZR25747,Oregon,female,College,827774,45257,103,0,Corporate Auto,Two-Door Car,494 +NQ86532,California,male,High School or Below,257645,26854,66,0,Personal Auto,Four-Door Car,475 +JY27336,Oregon,female,College,820538,85840,102,2,Corporate Auto,SUV,138 +PB54378,Oregon,female,Doctor,1958246,26463,72,0,Corporate Auto,Four-Door Car,345 +SV38190,Nevada,female,Bachelor,648152,30689,81,0,Personal Auto,Four-Door Car,467 +CV24005,Oregon,male,High School or Below,259931,29590,66,0,Corporate Auto,Two-Door Car,467 +EX28656,Oregon,female,College,983033,25965,253,0,Personal Auto,Luxury,1214 +CF57022,Oregon,male,Bachelor,1044265,17269,139,0,Personal Auto,SUV,667 +GM16780,Oregon,male,College,3605753,90330,137,3,Corporate Auto,Luxury,192 +BX94438,California,female,High School or Below,847003,0,113,0,Corporate Auto,SUV,619 +RM41745,California,female,High School or Below,827878,0,110,0,Personal Auto,Four-Door Car,1002 +XR70252,California,female,High School or Below,478893,0,67,1,Personal Auto,Two-Door Car,321 +YH92099,Arizona,female,Bachelor,308799,18558,80,0,Special Auto,Four-Door Car,384 +SG81493,Arizona,male,Bachelor,444373,46384,113,0,Corporate Auto,Four-Door Car,251 +ZX23819,Oregon,female,High School or Below,798408,0,72,0,Personal Auto,Two-Door Car,866 +FJ54907,Oregon,female,College,718097,42303,180,0,Personal Auto,Luxury,1210 +CU26127,California,female,Bachelor,1565603,71731,130,0,Corporate Auto,SUV,599 +YH60476,Oregon,male,High School or Below,578018,51066,74,0,Corporate Auto,Four-Door Car,787 +ZZ97035,California,male,College,2071494,0,203,0,Corporate Auto,Luxury,2027 +GE82737,Nevada,female,Bachelor,533735,0,86,3,Personal Auto,Four-Door Car,619 +KY21873,Arizona,male,College,505082,0,69,0,Personal Auto,Two-Door Car,72 +UA51318,Arizona,female,High School or Below,511662,26173,68,1,Corporate Auto,Four-Door Car,449 +BV55014,Oregon,male,Bachelor,726873,24445,63,0,Personal Auto,Two-Door Car,302 +HX21307,Oregon,male,College,261661,72302,66,0,Personal Auto,Two-Door Car,316 +LQ68252,Oregon,male,High School or Below,373843,27208,102,0,Personal Auto,SUV,489 +CR92802,California,female,Master,272535,36650,69,1,Special Auto,Four-Door Car,56 +SL35268,Arizona,male,College,545386,30855,68,0,Corporate Auto,Four-Door Car,259 +RD62882,Arizona,female,Bachelor,684615,0,95,0,Personal Auto,Two-Door Car,456 +JS42382,Oregon,male,Master,617291,99960,76,0,Corporate Auto,Four-Door Car,364 +BT30554,Arizona,female,Bachelor,1034632,0,98,0,Personal Auto,Four-Door Car,470 +VP57424,Nevada,female,Bachelor,699700,55873,88,0,Personal Auto,Four-Door Car,299 +VU19243,Arizona,female,High School or Below,419625,18052,111,0,Personal Auto,Four-Door Car,699 +TA82973,Oregon,female,High School or Below,785810,28937,104,2,Personal Auto,SUV,117 +GK71720,Oregon,female,High School or Below,606434,0,86,0,Personal Auto,Four-Door Car,545 +OQ61223,California,male,College,1749752,0,73,0,Personal Auto,Two-Door Car,350 +LL62746,Oregon,male,Doctor,897064,12829,118,0,Personal Auto,SUV,328 +JQ56711,Oregon,female,Master,592311,92163,73,0,Personal Auto,Two-Door Car,66 +AW77988,Oregon,male,High School or Below,3585059,17588,192,0,Personal Auto,Luxury,1382 +QP84605,Washington,female,Bachelor,870984,41546,111,0,Corporate Auto,Four-Door Car,121 +MY97912,Arizona,male,College,1330933,0,127,0,Personal Auto,SUV,609 +IB87349,California,male,High School or Below,452850,70340,113,0,Special Auto,Four-Door Car,542 +AW73065,Oregon,female,High School or Below,279190,0,74,0,Personal Auto,Four-Door Car,532 +BW80872,Washington,male,High School or Below,443441,34549,111,0,Personal Auto,Four-Door Car,125 +PX70175,Arizona,male,College,799600,93459,99,0,Personal Auto,Four-Door Car,655 +KF75098,Arizona,male,Bachelor,512973,86148,65,2,Personal Auto,Four-Door Car,312 +IS50283,California,female,Bachelor,569717,27048,72,0,Corporate Auto,Four-Door Car,345 +MY64920,Oregon,female,College,921713,73259,115,0,Personal Auto,SUV,673 +KN34250,Oregon,female,College,1020892,35482,129,0,Corporate Auto,SUV,619 +GN46207,Oregon,female,Master,417068,29462,107,1,Personal Auto,SUV,513 +KL57176,Oregon,female,College,450540,67801,115,1,Personal Auto,SUV,23 +MN94234,California,male,High School or Below,310756,0,94,4,Personal Auto,Two-Door Car,451 +JY90595,Arizona,male,High School or Below,552866,16042,73,0,Personal Auto,Two-Door Car,350 +HK26543,California,male,High School or Below,504586,28056,64,1,Personal Auto,Four-Door Car,307 +PN86062,California,male,High School or Below,296272,16495,85,3,Corporate Auto,Four-Door Car,408 +VW27730,California,female,Master,866595,41163,108,0,Corporate Auto,SUV,231 +SH55671,Arizona,female,College,1141344,0,161,1,Personal Auto,Luxury,772 +MO56878,California,male,Bachelor,1548843,33799,109,3,Corporate Auto,SUV,664 +VO38365,Washington,female,College,886114,90125,110,0,Corporate Auto,SUV,128 +SV35618,Oregon,female,Bachelor,593474,87747,147,1,Personal Auto,SUV,46 +RX12347,Nevada,male,College,354323,35695,90,0,Personal Auto,Four-Door Car,432 +FR55658,California,male,Master,349002,90985,87,0,Personal Auto,Four-Door Car,78 +XS12556,California,female,College,368309,0,101,0,Corporate Auto,Luxury,564 +ZU73588,California,male,College,598977,66839,154,0,Personal Auto,Luxury,739 +WT43034,California,female,High School or Below,1250084,0,165,0,Personal Auto,SUV,792 +VM13430,Oregon,female,Bachelor,860915,79090,107,0,Corporate Auto,SUV,289 +TC78849,Oregon,male,Bachelor,249745,24825,64,0,Personal Auto,Two-Door Car,155 +VC34764,California,male,College,701917,26806,63,0,Personal Auto,Four-Door Car,302 +WO90953,Oregon,female,College,538792,56835,67,0,Personal Auto,Two-Door Car,326 +IU47468,Oregon,female,Bachelor,616555,0,88,0,Special Auto,Two-Door Car,653 +KO46064,California,male,Bachelor,273020,46135,69,0,Personal Auto,Four-Door Car,103 +RB34917,Arizona,female,Bachelor,516211,0,73,0,Personal Auto,Four-Door Car,809 +BI38192,Oregon,female,High School or Below,793706,22862,67,0,Personal Auto,Two-Door Car,321 +PU18983,Oregon,female,High School or Below,860815,21450,110,2,Personal Auto,Luxury,528 +SW79912,Oregon,male,Bachelor,263254,95854,65,0,Personal Auto,Two-Door Car,312 +ES39217,Oregon,female,Bachelor,778500,44897,99,1,Personal Auto,Four-Door Car,580 +KP72427,Washington,male,High School or Below,2163983,64455,108,0,Personal Auto,SUV,133 +UA19178,Oregon,female,Master,498082,53265,62,0,Personal Auto,Four-Door Car,238 +PR53785,Arizona,female,High School or Below,745723,0,198,1,Personal Auto,Luxury,1577 +XF57481,Washington,male,Master,1064093,50450,90,0,Personal Auto,Two-Door Car,135 +CN90378,California,female,High School or Below,686250,54780,88,3,Personal Auto,Four-Door Car,135 +KI56154,Nevada,male,High School or Below,904898,0,119,0,Personal Auto,Luxury,571 +UI55951,California,male,Bachelor,554803,67798,69,0,Personal Auto,Four-Door Car,331 +FF28650,Oregon,male,Bachelor,831268,21442,118,0,Personal Auto,SUV,566 +FS55302,California,male,Bachelor,238998,27615,62,1,Personal Auto,Four-Door Car,297 +TN79487,California,male,Bachelor,445811,17622,65,1,Personal Auto,Four-Door Car,312 +HG32616,Nevada,male,High School or Below,529574,50200,135,0,Personal Auto,Luxury,637 +UK41984,Arizona,female,Doctor,383960,0,112,2,Personal Auto,SUV,537 +LZ52266,California,female,High School or Below,373150,0,96,0,Personal Auto,Four-Door Car,460 +PM27367,California,female,Master,277890,73570,70,1,Special Auto,Two-Door Car,75 +ZK21724,Oregon,female,High School or Below,401654,0,111,0,Personal Auto,SUV,799 +BH35482,Washington,male,Doctor,493094,70412,61,0,Corporate Auto,Two-Door Car,136 +QE22757,Nevada,male,Doctor,249131,36631,62,0,Personal Auto,Four-Door Car,67 +ON77649,Oregon,female,College,290887,35895,73,0,Personal Auto,Four-Door Car,312 +RN82884,Arizona,female,College,428294,40864,109,1,Personal Auto,SUV,166 +CQ75652,Oregon,male,College,834162,0,118,0,Personal Auto,Four-Door Car,566 +FF58467,Arizona,female,Master,509078,93018,63,0,Personal Auto,Four-Door Car,135 +BS83666,Oregon,male,Bachelor,736618,70014,62,0,Corporate Auto,Four-Door Car,17 +WO29605,Oregon,female,College,243687,48875,61,0,Personal Auto,Two-Door Car,1 +TL77607,California,male,Bachelor,885268,67969,74,0,Personal Auto,Four-Door Car,197 +EZ50606,Oregon,female,High School or Below,2387547,0,108,0,Corporate Auto,SUV,612 +OS39723,Oregon,female,Doctor,560049,68665,69,0,Personal Auto,Two-Door Car,331 +FN69743,California,male,College,463654,26802,66,1,Corporate Auto,Two-Door Car,316 +XW96958,Nevada,male,High School or Below,757334,0,110,0,Corporate Auto,Four-Door Car,1193 +TU92578,California,male,College,1469663,45345,125,0,Personal Auto,SUV,600 +TL43709,Washington,male,Bachelor,897214,89689,74,0,Personal Auto,Four-Door Car,136 +YE68736,California,female,Bachelor,772484,32051,193,1,Personal Auto,SUV,926 +OB96537,Oregon,male,Master,594667,81139,74,0,Special Auto,Four-Door Car,392 +EU68825,Oregon,female,Master,800054,63834,100,1,Personal Auto,Luxury,215 +CC31456,Arizona,male,Bachelor,645756,37548,81,0,Special Auto,Four-Door Car,160 +DJ77787,Arizona,female,High School or Below,728144,0,69,3,Personal Auto,Four-Door Car,371 +LN26837,California,male,High School or Below,259243,72421,65,0,Personal Auto,Four-Door Car,312 +YI92916,Nevada,male,Master,467842,83102,116,0,Corporate Auto,Four-Door Car,443 +NW54906,Oregon,male,College,1386992,28432,118,0,Personal Auto,SUV,612 +ME77513,Nevada,female,Master,871777,83707,108,0,Corporate Auto,Four-Door Car,290 +UK76891,California,female,College,523398,63259,65,0,Corporate Auto,Four-Door Car,316 +SI26888,Nevada,female,High School or Below,476418,0,67,0,Personal Auto,Four-Door Car,405 +YD74948,Oregon,female,College,247246,63860,62,0,Personal Auto,Four-Door Car,208 +HB64268,Washington,male,Bachelor,281369,43836,73,0,Personal Auto,Four-Door Car,138 +BW52697,California,female,College,550505,86132,68,0,Personal Auto,Two-Door Car,301 +NL41409,Oregon,female,Bachelor,260620,28519,66,0,Personal Auto,Two-Door Car,456 +OD69005,Arizona,female,High School or Below,1048194,39102,88,0,Personal Auto,Four-Door Car,152 +ZZ91716,California,female,Bachelor,325676,0,89,0,Personal Auto,Four-Door Car,491 +UK70255,California,female,College,3047578,97298,128,0,Personal Auto,Luxury,48 +QT25383,Nevada,male,High School or Below,636490,41986,84,2,Personal Auto,Two-Door Car,430 +AW18068,Arizona,male,High School or Below,946850,0,88,0,Personal Auto,Two-Door Car,633 +NS45347,Oregon,female,College,563145,17291,73,0,Personal Auto,Four-Door Car,350 +FV19421,California,male,Bachelor,778099,0,74,0,Personal Auto,Four-Door Car,246 +XW89091,California,male,College,981652,37256,62,0,Personal Auto,Four-Door Car,128 +YC11951,Oregon,male,High School or Below,751913,96306,95,1,Corporate Auto,Four-Door Car,185 +UY18770,California,female,Bachelor,1017971,14290,271,0,Personal Auto,Luxury,1300 +RA49085,California,female,College,277283,37038,71,1,Corporate Auto,Four-Door Car,9 +BG84194,Oregon,male,College,403750,90760,103,2,Special Auto,SUV,133 +PT64580,Washington,male,Master,419196,77048,103,0,Personal Auto,SUV,141 +MR67738,Oregon,female,High School or Below,267686,54480,67,0,Personal Auto,Four-Door Car,321 +DM95829,California,male,College,252395,16244,68,0,Personal Auto,Two-Door Car,623 +DB75522,California,female,College,698840,22436,89,0,Special Auto,Four-Door Car,427 +LM34525,Washington,female,College,874205,71592,72,0,Personal Auto,Four-Door Car,141 +WW30771,Arizona,male,Master,267331,28728,67,0,Personal Auto,Four-Door Car,321 +QP65569,Arizona,male,High School or Below,1215732,57449,103,0,Personal Auto,Four-Door Car,494 +TN50051,California,female,Doctor,295776,83318,73,0,Personal Auto,Two-Door Car,211 +UO86707,Washington,male,Bachelor,717390,75217,61,1,Personal Auto,Four-Door Car,147 +JA41698,Nevada,male,Bachelor,309953,0,102,5,Corporate Auto,SUV,862 +NX18774,Oregon,male,Bachelor,841568,55308,107,0,Corporate Auto,SUV,513 +DA69469,Oregon,female,College,2684312,36068,97,0,Personal Auto,Two-Door Car,113 +CN23147,Oregon,male,Bachelor,1305717,48804,112,1,Corporate Auto,Four-Door Car,537 +RA68844,Oregon,male,College,959995,0,131,0,Personal Auto,SUV,943 +GH42026,Oregon,male,Bachelor,853510,55790,111,0,Personal Auto,SUV,117 +BD16530,Arizona,female,Bachelor,829348,70258,69,0,Personal Auto,Four-Door Car,225 +JH91579,Oregon,female,Bachelor,684615,0,95,0,Personal Auto,Two-Door Car,456 +WK23685,Oregon,female,Bachelor,663685,47274,83,1,Corporate Auto,Four-Door Car,182 +GR62267,Washington,female,College,560908,44705,71,0,Personal Auto,Two-Door Car,148 +PI78084,Arizona,male,High School or Below,507732,0,73,0,Personal Auto,Two-Door Car,525 +GF97874,Washington,female,Master,527562,70446,65,0,Personal Auto,Four-Door Car,155 +ZH19885,Washington,female,High School or Below,251459,43860,65,0,Personal Auto,Four-Door Car,156 +UK25655,Oregon,female,Bachelor,343525,64348,86,0,Personal Auto,Two-Door Car,212 +QR45101,Oregon,male,Bachelor,662461,0,62,0,Corporate Auto,Two-Door Car,297 +EL93539,California,male,Master,575744,88997,72,0,Special Auto,Four-Door Car,174 +EE99484,Washington,female,High School or Below,251459,43860,65,0,Corporate Auto,Four-Door Car,156 +DP46882,California,female,High School or Below,288645,10312,78,0,Corporate Auto,Four-Door Car,486 +WP41146,California,female,High School or Below,534143,0,72,1,Personal Auto,Four-Door Car,345 +TK60799,Arizona,female,High School or Below,416001,96263,103,0,Personal Auto,SUV,1 +DN29808,California,female,College,284624,28919,72,0,Corporate Auto,Four-Door Car,518 +SS59521,Oregon,female,College,477025,0,68,1,Personal Auto,Two-Door Car,326 +NG66579,Oregon,male,Bachelor,505961,41869,64,0,Personal Auto,Two-Door Car,262 +TC14209,Arizona,female,High School or Below,909574,0,128,0,Personal Auto,SUV,921 +ED50963,California,female,High School or Below,268886,32808,68,1,Personal Auto,Four-Door Car,541 +GP40701,California,female,Bachelor,827763,79780,68,0,Personal Auto,Four-Door Car,326 +CP98451,Oregon,female,College,905793,91025,112,0,Personal Auto,SUV,327 +NX52648,California,female,High School or Below,380175,33043,95,0,Personal Auto,Two-Door Car,456 +ZC32510,Arizona,male,High School or Below,933934,69442,118,3,Personal Auto,Four-Door Car,1265 +NG27780,Oregon,male,College,252012,0,70,0,Corporate Auto,Four-Door Car,63 +HN95240,Arizona,female,College,498409,0,70,0,Corporate Auto,Four-Door Car,336 +EB59129,Oregon,female,Bachelor,259574,47234,65,0,Personal Auto,Four-Door Car,15 +RA70851,Oregon,male,High School or Below,743769,86863,92,0,Personal Auto,Four-Door Car,441 +PM19162,Oregon,male,Bachelor,1453678,25805,66,2,Personal Auto,Four-Door Car,375 +MS59005,Nevada,male,Bachelor,591330,43676,76,0,Personal Auto,Four-Door Car,364 +SU71163,Arizona,male,College,277166,59855,74,4,Personal Auto,Two-Door Car,355 +BD35676,Arizona,male,Master,2919436,35296,126,0,Personal Auto,SUV,452 +NI44621,Oregon,female,Master,988038,36576,125,1,Personal Auto,SUV,113 +EW33419,California,female,High School or Below,1511440,28513,100,1,Corporate Auto,SUV,480 +HX44948,Oregon,male,Bachelor,575991,85448,72,0,Special Auto,Four-Door Car,16 +DL36983,Oregon,female,High School or Below,849516,23791,110,3,Personal Auto,Two-Door Car,615 +XR87264,California,female,Bachelor,438118,20597,112,0,Personal Auto,Four-Door Car,615 +NN99001,Arizona,female,College,699782,56940,87,0,Personal Auto,Four-Door Car,512 +XV95530,Oregon,male,Bachelor,1143058,93210,71,0,Personal Auto,Two-Door Car,74 +OL97871,Oregon,female,Bachelor,748248,48992,94,1,Personal Auto,Four-Door Car,426 +HQ23708,Arizona,female,Master,859691,53736,71,0,Personal Auto,Two-Door Car,169 +WR63188,Arizona,male,College,785496,25378,66,1,Personal Auto,Four-Door Car,419 +NG82219,Oregon,female,Bachelor,258240,76731,64,0,Personal Auto,Four-Door Car,201 +KU29408,Washington,male,Master,907576,37722,116,0,Corporate Auto,Luxury,158 +RE46783,California,female,Bachelor,411858,69379,103,0,Personal Auto,Two-Door Car,494 +RU94434,Oregon,male,High School or Below,1215732,57449,103,0,Personal Auto,Four-Door Car,494 +GI82355,Arizona,male,Bachelor,515281,0,68,0,Corporate Auto,Four-Door Car,326 +VO26340,Nevada,male,College,651297,0,93,0,Personal Auto,Two-Door Car,669 +NV61299,Arizona,female,Bachelor,2778969,33806,89,0,Corporate Auto,Four-Door Car,395 +DX31066,Washington,female,College,266727,94041,66,0,Personal Auto,Four-Door Car,159 +CY50337,Oregon,female,College,1092840,74965,90,0,Personal Auto,Four-Door Car,58 +TJ20375,Arizona,female,High School or Below,761538,34095,63,0,Personal Auto,Two-Door Car,302 +EP72155,California,female,College,200435,0,66,4,Personal Auto,Four-Door Car,316 +JJ76159,California,male,College,243468,96045,61,0,Corporate Auto,Four-Door Car,8 +BG15419,Nevada,female,Bachelor,1419536,86355,118,0,Personal Auto,Luxury,285 +AO74776,California,female,High School or Below,942768,27824,118,0,Personal Auto,SUV,566 +HQ82233,California,male,High School or Below,1198242,42995,101,0,Personal Auto,SUV,410 +OL72737,Oregon,female,High School or Below,310278,21235,79,0,Personal Auto,Two-Door Car,244 +ZQ59828,California,male,High School or Below,422263,74585,106,0,Personal Auto,SUV,218 +NZ15548,Oregon,male,Bachelor,402381,41833,103,0,Personal Auto,Four-Door Car,643 +XK61304,California,female,College,529715,23908,70,0,Personal Auto,Four-Door Car,336 +EJ44139,Oregon,male,Bachelor,2142363,0,65,0,Personal Auto,Two-Door Car,312 +CM94425,Arizona,male,Bachelor,441620,61953,113,0,Personal Auto,SUV,497 +OV54878,California,male,Bachelor,463903,0,142,0,Corporate Auto,SUV,1022 +JF57282,Nevada,male,Bachelor,486354,0,137,0,Personal Auto,SUV,657 +MY37953,Arizona,female,Bachelor,2583090,73760,107,1,Personal Auto,Luxury,230 +XP64922,Oregon,female,College,297431,23333,74,0,Corporate Auto,Four-Door Car,5 +WL65572,California,male,College,206445,0,61,0,Personal Auto,Four-Door Car,292 +LN50325,Arizona,female,High School or Below,1006460,20440,128,2,Corporate Auto,Luxury,614 +HJ15383,Washington,male,Master,803240,27658,68,0,Personal Auto,Four-Door Car,160 +KH59823,California,male,College,548921,50943,139,0,Special Auto,SUV,667 +YM79169,California,male,Bachelor,261275,19003,71,0,Personal Auto,Two-Door Car,34 +DR38127,California,male,College,857346,46703,108,0,Personal Auto,Four-Door Car,678 +PU42145,California,male,Bachelor,2412750,14072,71,0,Personal Auto,Four-Door Car,511 +KM33477,Oregon,male,College,855038,21733,73,0,Corporate Auto,Four-Door Car,525 +RI53167,Arizona,male,Bachelor,230864,20811,61,0,Personal Auto,Four-Door Car,292 +OF77789,Arizona,female,High School or Below,425462,11904,61,2,Personal Auto,Two-Door Car,292 +YB33445,Oregon,female,College,898285,43490,114,4,Corporate Auto,SUV,174 +BA17836,California,male,High School or Below,786816,57340,67,0,Corporate Auto,Four-Door Car,159 +JS43228,California,male,College,770424,49088,97,0,Corporate Auto,Four-Door Car,698 +BB11622,Nevada,male,Master,1055217,47761,131,0,Personal Auto,SUV,232 +HQ70429,Washington,female,College,1604510,0,65,0,Personal Auto,Two-Door Car,163 +WK88044,Arizona,male,Bachelor,873783,61281,110,0,Personal Auto,SUV,79 +LA80525,Nevada,male,Bachelor,545489,0,82,1,Corporate Auto,Two-Door Car,393 +EH16250,Arizona,male,Bachelor,770528,25290,66,0,Personal Auto,Four-Door Car,382 +PU41872,Arizona,female,High School or Below,703926,24239,88,0,Personal Auto,Four-Door Car,48 +HB85743,California,male,Bachelor,883808,82664,114,3,Personal Auto,SUV,133 +MM71959,Arizona,male,Bachelor,873352,83210,110,0,Personal Auto,Luxury,528 +MB83663,Oregon,female,Bachelor,959747,38736,81,0,Personal Auto,Two-Door Car,561 +KR43119,California,male,College,450666,0,66,0,Personal Auto,Four-Door Car,316 +KH24214,Oregon,male,College,1785797,55437,64,1,Personal Auto,Four-Door Car,445 +AC40767,Washington,male,Bachelor,249780,68041,6464,0,Personal Auto,Two-Door Car,165 +HP55391,Oregon,male,Master,542613,0,71,0,Corporate Auto,Four-Door Car,407 +EG62398,California,female,High School or Below,799814,29066,100,0,Personal Auto,SUV,844 +VS19949,Nevada,male,Bachelor,289762,54337,72,0,Personal Auto,Four-Door Car,345 +AM92343,Oregon,female,High School or Below,1159950,67616,96,0,Personal Auto,Four-Door Car,340 +GI68556,California,female,Bachelor,1514793,41082,63,0,Personal Auto,Two-Door Car,106 +JT11876,Washington,female,High School or Below,543576,0,10202,0,Personal Auto,Four-Door Car,626 +XR64251,Nevada,female,Master,272535,36650,69,1,Personal Auto,Four-Door Car,56 +MK34957,Oregon,female,College,1329771,50631,112,4,Special Auto,SUV,784 +GP18756,California,male,College,992704,19592,92,0,Personal Auto,Four-Door Car,441 +AP23850,Washington,female,High School or Below,1777154,0,114,0,Personal Auto,Two-Door Car,547 +KQ65521,Arizona,female,College,1826927,55761,115,0,Personal Auto,Luxury,86 +EJ19449,California,female,College,272221,17576,71,0,Special Auto,Four-Door Car,398 +QB70027,California,female,Bachelor,708321,41449,89,0,Personal Auto,Four-Door Car,63 +QW47320,California,female,Bachelor,1017971,14290,271,0,Personal Auto,Luxury,1300 +KH64733,Nevada,female,College,588950,62007,73,0,Personal Auto,Four-Door Car,120 +ON59472,Arizona,male,High School or Below,1577139,21921,206,0,Corporate Auto,Luxury,1254 +HP94242,Arizona,female,Bachelor,528817,42621,66,0,Personal Auto,Four-Door Car,316 +RV15398,Oregon,male,College,2758055,0,87,1,Personal Auto,Four-Door Car,417 +EA25683,Washington,male,High School or Below,777853,63786,196,0,Corporate Auto,Luxury,798 +PW73754,California,female,High School or Below,734186,0,104,3,Personal Auto,Luxury,82 +MC71942,California,female,High School or Below,791919,82877,99,1,Personal Auto,Two-Door Car,22 +OX72195,Arizona,male,College,216387,0,63,0,Corporate Auto,Two-Door Car,302 +YQ99152,Nevada,male,High School or Below,978780,10475,88,1,Personal Auto,Two-Door Car,422 +KI19439,Oregon,female,High School or Below,520764,21952,66,0,Personal Auto,Four-Door Car,316 +PM76175,Oregon,female,Bachelor,2114727,49721,132,0,Corporate Auto,Luxury,639 +US45383,California,male,College,1228076,88340,102,0,Personal Auto,Two-Door Car,489 +GT38956,California,female,College,244139,0,65,0,Personal Auto,Four-Door Car,312 +SN41301,Oregon,male,Bachelor,653556,0,65,0,Corporate Auto,Four-Door Car,468 +BE62503,Washington,female,College,920659,24589,82,0,Personal Auto,Two-Door Car,511 +PA16884,California,female,Bachelor,411858,69379,103,0,Personal Auto,Two-Door Car,494 +NC58480,Nevada,female,Bachelor,483820,73769,61,2,Personal Auto,Four-Door Car,239 +NS39326,California,female,College,462554,66670,114,0,Personal Auto,SUV,518 +PN18507,Arizona,male,Bachelor,1404210,88854,118,0,Personal Auto,Two-Door Car,715 +EK91340,Oregon,male,Bachelor,754661,31266,193,0,Corporate Auto,Luxury,926 +JY16280,California,female,High School or Below,251459,43860,65,0,Personal Auto,Four-Door Car,156 +ZW71731,California,male,Bachelor,517035,89284,133,2,Corporate Auto,SUV,402 +ZC24631,Oregon,male,College,1391737,67267,89,0,Corporate Auto,Four-Door Car,94 +YR34689,California,female,High School or Below,1131813,79270,95,3,Personal Auto,Four-Door Car,456 +RT65829,Oregon,male,Bachelor,427636,36692,109,1,Personal Auto,Four-Door Car,523 +BZ12077,Oregon,female,High School or Below,432224,0,119,0,Personal Auto,SUV,571 +WM65373,California,female,College,800230,0,107,0,Corporate Auto,SUV,513 +NH35059,Nevada,male,College,388545,0,105,0,Corporate Auto,Four-Door Car,504 +QD38160,Oregon,male,College,447177,0,135,0,Personal Auto,SUV,972 +BM15160,California,female,High School or Below,849635,44624,71,1,Special Auto,Four-Door Car,73 +VY79030,Arizona,female,College,2250088,0,71,0,Corporate Auto,Four-Door Car,340 +EV19512,Nevada,female,Master,1630196,19614,85,0,Personal Auto,Two-Door Car,574 +TE13577,Oregon,female,College,231973,0,64,0,Personal Auto,Four-Door Car,632 +WY97929,Arizona,male,College,871704,83846,74,3,Special Auto,Four-Door Car,355 +YG20683,Washington,male,College,286011,51159,72,0,Personal Auto,Four-Door Car,4 +FK75497,California,male,College,245340,83772,62,0,Personal Auto,Two-Door Car,42 +NE60110,Arizona,male,College,598977,66839,154,0,Personal Auto,Luxury,739 +TN36521,Arizona,female,College,2498022,88440,70,0,Personal Auto,Two-Door Car,27 +HG33568,Arizona,female,Master,748263,25666,63,2,Personal Auto,Four-Door Car,270 +TW17878,Oregon,female,High School or Below,245757,52926,61,0,Personal Auto,Four-Door Car,292 +ZO83562,Nevada,female,Bachelor,237974,0,67,0,Personal Auto,Four-Door Car,494 +CH97539,Washington,female,Bachelor,828696,40001,70,0,Personal Auto,Four-Door Car,142 +CV29889,California,male,College,239391,0,70,0,Personal Auto,Four-Door Car,425 +MO33320,Oregon,male,College,465715,18024,65,0,Personal Auto,Two-Door Car,312 +QZ81258,Oregon,female,College,1319792,0,68,3,Personal Auto,Four-Door Car,326 +NY56352,Oregon,female,Bachelor,280391,23220,74,0,Personal Auto,Four-Door Car,251 +EA27048,California,female,High School or Below,864650,64125,108,0,Personal Auto,SUV,369 +UT38865,Oregon,female,College,742587,58042,62,0,Corporate Auto,Four-Door Car,161 +QC89139,Oregon,female,High School or Below,452873,90034,112,0,Corporate Auto,SUV,537 +LA14484,Nevada,male,High School or Below,222707,27972,61,0,Special Auto,Four-Door Car,292 +HN57556,California,female,High School or Below,729294,0,65,0,Personal Auto,Four-Door Car,312 +CV31235,Arizona,male,Bachelor,318435,50989,80,0,Corporate Auto,Four-Door Car,255 +WR45726,Arizona,female,Bachelor,1131520,11885,101,0,Special Auto,Four-Door Car,484 +LB25094,California,female,Bachelor,253070,89451,63,0,Special Auto,Four-Door Car,61 +KW56110,Oregon,male,Bachelor,1836155,0,182,0,Personal Auto,Luxury,1310 +XO36233,Washington,male,Bachelor,864153,78904,109,0,Personal Auto,SUV,250 +ZX86243,Arizona,male,Doctor,327853,70247,83,1,Personal Auto,Four-Door Car,141 +DW29763,Arizona,male,High School or Below,527198,32653,67,0,Personal Auto,Two-Door Car,321 +CT83377,Washington,male,High School or Below,376363,93595,97,4,Special Auto,Four-Door Car,49 +OQ90898,California,male,Master,1395556,90279,115,0,Personal Auto,SUV,372 +GO77248,Oregon,female,College,500152,0,72,0,Personal Auto,Four-Door Car,542 +QW33258,California,male,Bachelor,708283,53310,189,3,Personal Auto,Luxury,1360 +OU79745,California,male,College,761948,0,105,0,Personal Auto,Four-Door Car,504 +VZ79886,Oregon,female,Bachelor,1255088,22234,160,0,Personal Auto,SUV,768 +FI92440,Washington,female,High School or Below,3219660,91375,99,0,Personal Auto,Two-Door Car,72 +YG85980,Nevada,female,High School or Below,679377,22250,86,0,Personal Auto,Two-Door Car,720 +QM74621,Oregon,male,Bachelor,527231,0,80,0,Personal Auto,Four-Door Car,576 +EI71732,Oregon,female,Doctor,626534,0,84,1,Personal Auto,Four-Door Car,481 +VN79010,California,female,High School or Below,854758,51179,71,0,Corporate Auto,Four-Door Car,466 +FI61723,California,male,Bachelor,278742,38667,72,0,Personal Auto,Four-Door Car,159 +OH55411,California,female,Master,462680,79487,114,0,Corporate Auto,SUV,547 +TF10720,Nevada,female,Doctor,866336,67763,107,2,Personal Auto,Four-Door Car,41 +NW30838,Nevada,male,High School or Below,387222,0,62,2,Corporate Auto,Four-Door Car,503 +CB58476,Oregon,female,College,517081,0,71,0,Corporate Auto,Four-Door Car,859 +WI69346,California,female,Master,896028,71943,112,0,Corporate Auto,SUV,305 +FS76657,Oregon,female,College,547183,53526,68,0,Personal Auto,Four-Door Car,278 +YX89016,Oregon,male,College,3493100,35005,295,0,Personal Auto,Luxury,1416 +PK28821,California,male,College,262039,24721,67,0,Personal Auto,Four-Door Car,139 +MB51200,Washington,male,College,1906949,0,102,2,Personal Auto,Four-Door Car,734 +XG44587,Arizona,male,Master,575744,88997,72,0,Personal Auto,Four-Door Car,174 +FG91922,Arizona,male,Master,4022401,48587,111,0,Personal Auto,SUV,532 +OM99303,Arizona,female,High School or Below,270148,76310,67,0,Personal Auto,Two-Door Car,321 +RV67546,California,male,Bachelor,371243,73205,92,0,Personal Auto,Four-Door Car,37 +UJ79253,Oregon,female,College,2185084,51056,78,0,Personal Auto,Four-Door Car,95 +PN98247,California,male,College,784016,58414,210,2,Personal Auto,Luxury,1008 +IB67546,California,female,Bachelor,823703,23940,107,0,Personal Auto,SUV,513 +OE19087,California,female,High School or Below,224347,0,62,0,Personal Auto,Four-Door Car,446 +CM95716,California,male,Bachelor,843446,44216,71,0,Personal Auto,Four-Door Car,72 +MW62634,California,male,High School or Below,222707,27972,61,0,Corporate Auto,Four-Door Car,292 +QW67581,Arizona,female,High School or Below,517002,0,69,0,Personal Auto,Four-Door Car,331 +SN16059,California,female,Master,264144,29305,66,0,Personal Auto,Four-Door Car,475 +OE51254,California,female,College,279068,53882,69,0,Personal Auto,Four-Door Car,331 +RM42344,Oregon,male,College,274512,91757,69,1,Personal Auto,Four-Door Car,331 +GB35238,California,female,Bachelor,757953,33906,64,0,Personal Auto,Two-Door Car,401 +ML82674,Oregon,male,Bachelor,1097878,68158,139,1,Personal Auto,SUV,253 +EI85244,California,male,College,825506,0,134,3,Personal Auto,SUV,643 +DE28132,Oregon,male,College,474773,42165,123,0,Corporate Auto,SUV,799 +TV25678,Washington,male,College,354090,0,101,0,Personal Auto,SUV,727 +TY26512,California,male,Doctor,343613,30817,88,0,Personal Auto,Four-Door Car,91 +OB69153,California,male,Bachelor,258218,68074,65,0,Personal Auto,Four-Door Car,27 +QZ77637,Washington,female,College,1166509,84978,35353,1,Corporate Auto,Four-Door Car,166 +XN41715,California,female,Master,739628,71135,92,1,Personal Auto,Four-Door Car,270 +QR15857,California,female,College,433079,0,61,0,Personal Auto,Two-Door Car,292 +FL69363,Oregon,male,Master,907576,37722,116,0,Personal Auto,Luxury,158 +IS30295,Arizona,female,Bachelor,1463545,0,139,0,Personal Auto,SUV,667 +WA25797,Washington,male,High School or Below,856476,95697,107,0,Personal Auto,Luxury,178 +NL59519,California,female,College,1156568,64642,96,0,Personal Auto,Four-Door Car,404 +ZU93025,Oregon,female,College,277104,50071,71,0,Personal Auto,Two-Door Car,18 +DK94262,Oregon,male,High School or Below,850712,46754,106,1,Personal Auto,SUV,513 +UQ30615,California,male,College,758211,64801,64,0,Corporate Auto,Four-Door Car,268 +OR40060,Arizona,male,Bachelor,332309,70410,83,0,Personal Auto,Four-Door Car,131 +DK32872,Nevada,female,High School or Below,523433,66957,131,1,Personal Auto,SUV,628 +FA46418,Nevada,female,High School or Below,2470959,24213,78,1,Personal Auto,Four-Door Car,374 +ER19995,Washington,female,College,1778627,99790,6464,0,Personal Auto,Four-Door Car,178 +KI75855,Oregon,male,Master,255122,79751,63,0,Personal Auto,Two-Door Car,392 +ND41876,Arizona,male,High School or Below,724771,86122,182,1,Personal Auto,Luxury,873 +PN21042,Arizona,male,Bachelor,453884,82297,116,0,Personal Auto,Luxury,0 +GJ43254,Washington,male,College,3164210,89057,98,0,Corporate Auto,Two-Door Car,187 +AL46984,California,male,High School or Below,873042,43259,73,0,Personal Auto,Four-Door Car,350 +JP58047,Oregon,male,College,833273,0,79,0,Personal Auto,Four-Door Car,379 +ZE85014,California,male,College,235774,25064,62,0,Personal Auto,Four-Door Car,297 +KU88219,Arizona,male,Master,463716,25816,119,0,Personal Auto,Luxury,571 +UU98729,California,male,Bachelor,535719,0,73,0,Personal Auto,Four-Door Car,350 +WS82822,Oregon,female,College,539197,41662,69,0,Corporate Auto,Four-Door Car,217 +YB49933,Arizona,male,Bachelor,369414,96170,92,0,Personal Auto,Four-Door Car,441 +XC16387,Arizona,female,High School or Below,504041,46072,64,0,Personal Auto,Four-Door Car,25 +XJ96748,Arizona,female,High School or Below,2749542,37931,99,0,Personal Auto,Four-Door Car,475 +TM98684,Oregon,male,High School or Below,484228,35127,62,0,Personal Auto,Four-Door Car,297 +AY18433,Washington,female,High School or Below,2738281,45473,76,0,Special Auto,Two-Door Car,188 +DM74502,Nevada,female,College,522710,93087,131,3,Corporate Auto,Luxury,628 +FT56968,Arizona,male,High School or Below,259009,22398,67,2,Personal Auto,Four-Door Car,321 +OX36896,California,male,High School or Below,1053607,92983,87,1,Corporate Auto,Four-Door Car,153 +BZ65376,Arizona,male,Bachelor,858127,27689,239,2,Personal Auto,Luxury,2893 +LN34660,California,female,College,946311,69654,118,0,Corporate Auto,SUV,629 +JC29295,California,female,Bachelor,1344100,80744,111,0,Personal Auto,SUV,361 +KJ87930,California,female,Bachelor,388650,0,112,0,Corporate Auto,SUV,1185 +XT36360,Arizona,female,High School or Below,678489,0,64,1,Personal Auto,Four-Door Car,460 +IX35050,Arizona,male,Bachelor,2359468,76358,66,0,Special Auto,Four-Door Car,86 +UN97379,Oregon,male,Bachelor,253862,18608,71,0,Corporate Auto,Four-Door Car,340 +MR57294,California,male,High School or Below,563994,73168,70,0,Personal Auto,Four-Door Car,425 +UG79499,Washington,male,Bachelor,1168137,70930,99,0,Personal Auto,Four-Door Car,190 +UA50747,Washington,female,High School or Below,2599775,62262,72,0,Corporate Auto,Four-Door Car,193 +GL20444,Nevada,female,Master,1377836,91474,113,0,Corporate Auto,Two-Door Car,24 +SP58110,California,female,Bachelor,492318,61469,63,5,Personal Auto,Four-Door Car,302 +XM91635,Arizona,female,High School or Below,227233,16618,62,0,Special Auto,Four-Door Car,219 +TV82603,California,female,Bachelor,1489539,48081,188,0,Personal Auto,Luxury,881 +BB82067,Oregon,male,Doctor,975604,67632,121,0,Personal Auto,Luxury,26 +JP94676,Oregon,female,Bachelor,942297,34115,119,0,Personal Auto,SUV,466 +VU53417,Arizona,male,High School or Below,383735,23051,99,0,Personal Auto,Two-Door Car,475 +IW54795,California,male,College,1095213,23748,99,0,Personal Auto,Four-Door Car,607 +RN78170,Arizona,female,College,815913,40589,69,0,Corporate Auto,Four-Door Car,331 +IX55883,California,female,College,1948049,50809,83,0,Personal Auto,Four-Door Car,290 +XM72420,Arizona,female,High School or Below,391936,66676,97,0,Personal Auto,Four-Door Car,558 +GC15104,Nevada,female,Bachelor,798514,52339,70,3,Corporate Auto,Four-Door Car,336 +RX13282,Oregon,male,Bachelor,1216874,14973,115,0,Personal Auto,SUV,828 +QA85890,Arizona,female,High School or Below,584932,0,83,0,Corporate Auto,Four-Door Car,540 +IR62668,Arizona,female,Bachelor,508583,31546,65,0,Personal Auto,Four-Door Car,100 +AL96740,California,female,College,290393,67763,73,1,Personal Auto,Four-Door Car,59 +SS48498,Washington,female,College,627317,20836,79,0,Corporate Auto,Four-Door Car,193 +PE39479,Washington,male,College,1832141,88592,76,0,Corporate Auto,Four-Door Car,199 +JH62891,Oregon,female,College,517870,66943,65,1,Special Auto,Four-Door Car,53 +FI20423,Arizona,female,High School or Below,1402435,81872,115,0,Special Auto,Four-Door Car,256 +PM13394,Washington,female,College,530943,22404,70,1,Personal Auto,Four-Door Car,211 +YV67971,California,female,High School or Below,494980,21342,62,0,Personal Auto,Four-Door Car,74 +QD31377,California,male,Bachelor,859566,34621,108,1,Corporate Auto,SUV,621 +YG10247,Oregon,male,College,2295189,62396,64,0,Personal Auto,Four-Door Car,307 +FE73696,Oregon,male,High School or Below,379213,97212,93,0,Personal Auto,Two-Door Car,360 +SW19699,Arizona,female,Bachelor,275574,49648,70,0,Personal Auto,Four-Door Car,65 +QJ40732,Arizona,male,College,488033,97984,61,1,Personal Auto,Four-Door Car,407 +HM76207,California,female,College,905190,26308,114,0,Corporate Auto,SUV,547 +NT59303,Oregon,female,College,1011544,63528,256,0,Personal Auto,Luxury,1228 +PU41393,Nevada,male,College,826907,20225,114,1,Special Auto,SUV,547 +QO86948,Nevada,male,High School or Below,807165,0,112,0,Personal Auto,SUV,806 +QN10888,Oregon,female,High School or Below,772699,87620,64,0,Personal Auto,Four-Door Car,24 +VY19543,California,female,Bachelor,831113,0,72,0,Corporate Auto,Four-Door Car,311 +XC15133,Nevada,female,Master,257402,34990,65,0,Personal Auto,Four-Door Car,42 +ST43550,Oregon,male,Bachelor,572732,99934,71,0,Special Auto,Four-Door Car,460 +FX36546,Washington,male,Master,367914,60804,92,0,Personal Auto,Four-Door Car,213 +JX68983,Oregon,male,Bachelor,274451,94648,69,0,Personal Auto,Four-Door Car,331 +HX78576,California,female,High School or Below,563674,24516,71,0,Personal Auto,Four-Door Car,300 +ZQ11381,Arizona,male,Bachelor,1687038,61063,85,0,Personal Auto,Four-Door Car,262 +ON39271,California,male,Master,273800,0,74,0,Personal Auto,Two-Door Car,263 +SB18278,Oregon,male,Bachelor,464470,0,64,0,Corporate Auto,Four-Door Car,307 +ZT30559,California,female,High School or Below,474668,15169,63,0,Personal Auto,Four-Door Car,302 +XI41106,Arizona,male,College,1687432,55390,71,0,Corporate Auto,Two-Door Car,256 +ZS88847,Oregon,female,Bachelor,238760,27592,62,0,Personal Auto,Four-Door Car,297 +RU49126,Washington,female,College,446533,61846,112,0,Personal Auto,SUV,215 +KR62797,Arizona,female,High School or Below,459162,83297,113,0,Personal Auto,SUV,542 +ZJ73220,Arizona,female,College,1309258,0,188,0,Special Auto,Luxury,1353 +FY62633,Oregon,male,Bachelor,911226,0,90,0,Personal Auto,Four-Door Car,432 +CU36986,California,female,High School or Below,416516,55897,104,0,Personal Auto,Four-Door Car,499 +WZ53904,Arizona,male,Bachelor,265998,21297,71,0,Personal Auto,Four-Door Car,45 +AA71604,Arizona,female,Master,1198659,87560,98,1,Personal Auto,Two-Door Car,470 +TD10493,Oregon,female,High School or Below,289873,0,96,4,Personal Auto,Four-Door Car,691 +LY97989,Oregon,female,Bachelor,289424,0,85,0,Personal Auto,Four-Door Car,408 +VX39856,Arizona,female,Doctor,350045,89398,86,0,Personal Auto,Four-Door Car,82 +TP51897,California,female,College,262180,36843,68,3,Corporate Auto,Four-Door Car,357 +QQ89253,Oregon,female,College,1022180,0,134,0,Personal Auto,SUV,643 +EI91403,California,male,High School or Below,257827,34946,65,0,Personal Auto,Two-Door Car,420 +QG15435,Arizona,female,College,624259,75680,78,0,Personal Auto,Four-Door Car,136 +FZ55002,Nevada,female,Doctor,522028,0,69,0,Personal Auto,Four-Door Car,331 +HX77930,Washington,female,College,313643,49532,79,1,Personal Auto,Four-Door Car,220 +UN37063,Arizona,male,Bachelor,452536,10269,65,0,Personal Auto,Two-Door Car,170 +VB87946,California,male,College,497035,49714,63,3,Personal Auto,Four-Door Car,266 +AB60627,California,male,High School or Below,1546778,77517,129,0,Corporate Auto,SUV,98 +TA34903,Oregon,male,High School or Below,583889,81082,73,0,Personal Auto,Four-Door Car,281 +AQ51368,Oregon,female,Bachelor,1065688,72540,88,0,Corporate Auto,Two-Door Car,631 +NZ26102,Oregon,female,High School or Below,228961,0,65,0,Personal Auto,Four-Door Car,468 +GB45753,California,male,High School or Below,543980,61546,68,0,Corporate Auto,Two-Door Car,29 +BV79904,California,female,Master,795615,44818,67,1,Personal Auto,Two-Door Car,136 +OB49075,Arizona,male,Bachelor,445811,17622,65,1,Personal Auto,Four-Door Car,312 +DS97676,Oregon,female,College,255505,0,72,0,Personal Auto,Four-Door Car,518 +JO63462,California,male,Bachelor,330799,79797,84,0,Corporate Auto,Two-Door Car,31 +NJ10602,Washington,female,College,845905,92717,70,0,Personal Auto,Two-Door Car,224 +RS24501,Oregon,female,College,1335012,28919,173,0,Personal Auto,SUV,830 +VT78274,Arizona,male,College,493122,0,68,0,Personal Auto,Four-Door Car,480 +SU56153,Nevada,male,Bachelor,777683,63568,65,0,Corporate Auto,Two-Door Car,390 +MN20737,Nevada,female,College,255367,73935,64,1,Corporate Auto,Four-Door Car,72 +KL43114,Arizona,female,High School or Below,487646,0,66,0,Corporate Auto,Two-Door Car,316 +YQ15567,Oregon,female,Bachelor,903430,18846,115,0,Personal Auto,SUV,552 +TR88637,Arizona,female,High School or Below,810591,38893,103,0,Personal Auto,SUV,41 +TC88986,Oregon,male,High School or Below,561968,0,153,0,Special Auto,SUV,1027 +XX88577,California,male,Bachelor,1572713,84824,196,0,Corporate Auto,SUV,319 +NE49052,California,female,High School or Below,661801,20068,86,0,Corporate Auto,Four-Door Car,411 +KX17826,Oregon,male,Doctor,467004,0,125,0,Corporate Auto,SUV,600 +CC91503,Arizona,female,High School or Below,1016936,0,135,0,Personal Auto,Luxury,648 +WH32183,California,male,Bachelor,832307,97245,70,0,Personal Auto,Four-Door Car,4 +ES90681,California,female,College,241776,51808,61,1,Personal Auto,Four-Door Car,351 +DW96592,California,male,Bachelor,804487,71391,67,0,Personal Auto,Four-Door Car,284 +MT23134,Oregon,male,High School or Below,532572,0,73,0,Personal Auto,Two-Door Car,496 +BM69081,Arizona,male,Bachelor,694752,0,100,0,Personal Auto,SUV,925 +MB90871,Oregon,female,College,584741,23496,77,0,Special Auto,Four-Door Car,13 +QL77686,Nevada,female,College,472478,23986,119,0,Corporate Auto,SUV,463 +ON77827,Arizona,female,Master,279022,22974,71,0,Personal Auto,Four-Door Car,180 +KP18988,Oregon,female,High School or Below,2153133,0,101,0,Personal Auto,Four-Door Car,484 +TI92884,Arizona,male,Bachelor,1262283,61844,106,0,Personal Auto,Luxury,508 +JH73503,Arizona,male,Doctor,2017196,24804,73,0,Personal Auto,Two-Door Car,350 +YE97964,California,female,Bachelor,1646436,27760,104,0,Personal Auto,SUV,302 +VA30351,Oregon,female,High School or Below,559538,74454,71,0,Personal Auto,Four-Door Car,340 +PV55726,Oregon,female,Master,417068,29462,107,1,Personal Auto,SUV,513 +UC88305,Arizona,female,College,266544,52266,68,0,Corporate Auto,Two-Door Car,141 +TS53809,Oregon,male,Bachelor,709891,0,70,0,Personal Auto,Two-Door Car,349 +ZV32120,California,male,Doctor,397134,23599,103,0,Corporate Auto,SUV,494 +FB80807,Oregon,male,Bachelor,552821,36088,72,0,Personal Auto,Four-Door Car,345 +AS55677,California,female,High School or Below,833899,70534,104,0,Personal Auto,Four-Door Car,54 +WA15684,Oregon,male,College,3844585,27398,125,1,Personal Auto,SUV,600 +SA50567,Nevada,male,Bachelor,544855,85296,68,0,Personal Auto,Four-Door Car,342 +KJ31611,Arizona,male,High School or Below,1080806,31063,92,0,Personal Auto,Four-Door Car,441 +VL37375,California,male,Bachelor,618509,0,92,0,Personal Auto,Two-Door Car,1027 +KN21017,Nevada,male,High School or Below,320822,52367,81,0,Personal Auto,Four-Door Car,275 +PX44289,Arizona,male,College,548010,58651,71,0,Personal Auto,Four-Door Car,472 +AM97901,Nevada,female,College,2298615,84831,192,0,Special Auto,Luxury,1336 +RE42925,Oregon,male,Bachelor,1310792,49088,114,1,Corporate Auto,SUV,547 +TR81766,California,female,College,746292,70263,93,0,Corporate Auto,Two-Door Car,7 +CH85057,Oregon,female,Doctor,1146399,45354,285,0,Personal Auto,Luxury,540 +UP71482,Arizona,male,High School or Below,723613,0,63,0,Personal Auto,Four-Door Car,383 +EG40670,California,female,Bachelor,623268,28334,83,0,Special Auto,Four-Door Car,537 +HV83672,Oregon,female,Bachelor,2839332,38772,90,0,Personal Auto,Four-Door Car,321 +MG10140,Oregon,female,College,374675,41479,94,1,Personal Auto,Two-Door Car,19 +TC44716,California,male,Bachelor,2156933,23909,119,0,Personal Auto,SUV,571 +QO65264,California,male,College,501208,48328,63,0,Personal Auto,Two-Door Car,108 +EB66698,California,male,High School or Below,337185,86689,85,0,Corporate Auto,Two-Door Car,408 +OT52034,California,male,Bachelor,386477,24204,99,1,Personal Auto,Four-Door Car,707 +CH85444,Oregon,male,College,414571,25943,110,0,Corporate Auto,Two-Door Car,1067 +PU85769,California,male,High School or Below,515607,0,73,0,Personal Auto,Four-Door Car,807 +UI73201,California,male,College,366737,62375,92,0,Personal Auto,Two-Door Car,618 +SL50592,California,female,High School or Below,783568,0,71,0,Corporate Auto,Four-Door Car,404 +XP11075,Arizona,male,Bachelor,1456726,0,148,0,Personal Auto,SUV,710 +SI31236,Oregon,male,Bachelor,1017133,70200,65,0,Corporate Auto,Four-Door Car,312 +JN26745,Nevada,female,Bachelor,413577,0,112,0,Special Auto,Four-Door Car,707 +VK48036,Oregon,female,College,551149,79027,70,0,Corporate Auto,Four-Door Car,336 +JX76668,Washington,female,High School or Below,1131424,62935,141,0,Personal Auto,Luxury,232 +DS45802,California,female,High School or Below,541461,26893,68,0,Personal Auto,Four-Door Car,68 +OA96690,Oregon,female,High School or Below,742159,47406,94,1,Personal Auto,Four-Door Car,287 +EM27919,California,male,Bachelor,445811,17622,65,1,Personal Auto,Four-Door Car,312 +QO41043,Oregon,female,College,1447612,27572,124,0,Corporate Auto,SUV,595 +OV50124,Oregon,female,College,493688,0,72,2,Personal Auto,Two-Door Car,391 +PR31642,Oregon,female,Bachelor,452527,32802,114,0,Personal Auto,SUV,547 +BU41599,Washington,female,Master,558176,62739,70,0,Personal Auto,Two-Door Car,239 +TK30357,California,female,Bachelor,1413434,90844,118,0,Personal Auto,SUV,232 +NF31087,Nevada,female,High School or Below,2472318,44685,69,0,Personal Auto,Four-Door Car,331 +NH16984,California,female,Bachelor,283806,0,80,0,Personal Auto,Four-Door Car,336 +OS75493,California,female,High School or Below,384848,42589,98,0,Corporate Auto,Four-Door Car,470 +VT63298,Oregon,male,Bachelor,1950447,0,72,0,Personal Auto,Four-Door Car,345 +QS75550,Washington,female,Bachelor,248004,93383,62,0,Corporate Auto,Two-Door Car,244 +SZ16483,Arizona,female,High School or Below,436137,79583,109,2,Personal Auto,Four-Door Car,523 +VM92311,Arizona,female,High School or Below,252907,89129,64,0,Personal Auto,Four-Door Car,328 +NJ46849,Arizona,male,College,250444,0,69,0,Personal Auto,Four-Door Car,496 +WZ31900,Oregon,female,Bachelor,864970,94389,107,0,Corporate Auto,SUV,85 +RG30482,Oregon,female,College,1366835,0,197,0,Personal Auto,SUV,1418 +ZM86949,Oregon,female,High School or Below,2063508,84106,64,0,Personal Auto,Two-Door Car,334 +QQ39596,Arizona,female,College,251753,0,69,0,Personal Auto,Four-Door Car,42 +FH51383,California,female,High School or Below,532667,76717,66,0,Personal Auto,Two-Door Car,300 +BJ53923,Arizona,male,High School or Below,260027,51978,66,0,Corporate Auto,Four-Door Car,144 +CZ96653,Oregon,female,Bachelor,853479,47325,107,0,Personal Auto,SUV,64 +FB23788,Oregon,male,High School or Below,882883,86721,111,0,Corporate Auto,SUV,532 +NT43594,Nevada,female,Bachelor,224844,24910,63,1,Personal Auto,Four-Door Car,347 +RJ85627,Washington,female,Bachelor,1230276,43817,62,1,Personal Auto,Four-Door Car,245 +KJ86296,Oregon,male,High School or Below,455659,0,73,2,Personal Auto,Four-Door Car,525 +PI47776,Oregon,female,Bachelor,253070,89451,63,0,Corporate Auto,Four-Door Car,61 +MD73554,California,male,College,525198,59537,66,0,Personal Auto,Two-Door Car,316 +UX92071,Oregon,male,High School or Below,674311,0,199,0,Personal Auto,Luxury,955 +YG44474,Oregon,male,College,1401472,54193,117,0,Corporate Auto,SUV,720 +UH45301,Oregon,male,College,943891,86946,118,0,Personal Auto,Four-Door Car,340 +RY92647,California,female,Bachelor,1050677,0,92,0,Personal Auto,Four-Door Car,546 +IK12620,Arizona,female,High School or Below,421391,12160,109,0,Personal Auto,Four-Door Car,489 +GQ66762,California,male,College,477368,33701,63,0,Personal Auto,Four-Door Car,171 +YT69858,Washington,female,Bachelor,544142,85702,67,0,Personal Auto,Two-Door Car,249 +XD85577,California,male,Bachelor,284226,69417,73,1,Personal Auto,Four-Door Car,30 +TM65736,Oregon,male,Master,305955,38644,78,1,Personal Auto,Four-Door Car,361 +VJ51327,California,female,High School or Below,2031499,63209,102,2,Personal Auto,SUV,207 +GS98873,Arizona,female,Bachelor,323912,16061,88,0,Personal Auto,Four-Door Car,633 +CW49887,California,female,Master,462680,79487,114,0,Special Auto,SUV,547 +MY31220,California,female,College,899704,54230,112,0,Personal Auto,Two-Door Car,537 diff --git a/lab-dw-data-cleaning-and-formatting.ipynb b/lab-dw-data-cleaning-and-formatting.ipynb index cdfc3c6..b9461a5 100644 --- a/lab-dw-data-cleaning-and-formatting.ipynb +++ b/lab-dw-data-cleaning-and-formatting.ipynb @@ -1,371 +1,2188 @@ { - "cells": [ - { - "cell_type": "markdown", - "id": "25d7736c-ba17-4aff-b6bb-66eba20fbf4e", - "metadata": { - "id": "25d7736c-ba17-4aff-b6bb-66eba20fbf4e" - }, - "source": [ - "# Lab | Data Cleaning and Formatting" - ] - }, - { - "cell_type": "markdown", - "id": "d1973e9e-8be6-4039-b70e-d73ee0d94c99", - "metadata": { - "id": "d1973e9e-8be6-4039-b70e-d73ee0d94c99" - }, - "source": [ - "In this lab, we will be working with the customer data from an insurance company, which can be found in the CSV file located at the following link: https://raw.githubusercontent.com/data-bootcamp-v4/data/main/file1.csv\n" - ] - }, - { - "cell_type": "markdown", - "id": "31b8a9e7-7db9-4604-991b-ef6771603e57", - "metadata": { - "id": "31b8a9e7-7db9-4604-991b-ef6771603e57" - }, - "source": [ - "# Challenge 1: Data Cleaning and Formatting" - ] - }, - { - "cell_type": "markdown", - "id": "81553f19-9f2c-484b-8940-520aff884022", - "metadata": { - "id": "81553f19-9f2c-484b-8940-520aff884022" - }, - "source": [ - "## Exercise 1: Cleaning Column Names" - ] - }, - { - "cell_type": "markdown", - "id": "34a929f4-1be4-4fa8-adda-42ffd920be90", - "metadata": { - "id": "34a929f4-1be4-4fa8-adda-42ffd920be90" - }, - "source": [ - "To ensure consistency and ease of use, standardize the column names of the dataframe. Start by taking a first look at the dataframe and identifying any column names that need to be modified. Use appropriate naming conventions and make sure that column names are descriptive and informative.\n", - "\n", - "*Hint*:\n", - "- *Column names should be in lower case*\n", - "- *White spaces in column names should be replaced by `_`*\n", - "- *`st` could be replaced for `state`*" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5810735c-8056-4442-bbf2-dda38d3e284a", - "metadata": { - "id": "5810735c-8056-4442-bbf2-dda38d3e284a" - }, - "outputs": [], - "source": [ - "# Your code here" - ] - }, - { - "cell_type": "markdown", - "id": "9cb501ec-36ff-4589-b872-6252bb150316", - "metadata": { - "id": "9cb501ec-36ff-4589-b872-6252bb150316" - }, - "source": [ - "## Exercise 2: Cleaning invalid Values" - ] - }, - { - "cell_type": "markdown", - "id": "771fdcf3-8e20-4b06-9c24-3a93ba2b0909", - "metadata": { - "id": "771fdcf3-8e20-4b06-9c24-3a93ba2b0909" - }, - "source": [ - "The dataset contains columns with inconsistent and incorrect values that could affect the accuracy of our analysis. Therefore, we need to clean these columns to ensure that they only contain valid data.\n", - "\n", - "Note that this exercise will focus only on cleaning inconsistent values and will not involve handling null values (NaN or None).\n", - "\n", - "*Hint*:\n", - "- *Gender column contains various inconsistent values such as \"F\", \"M\", \"Femal\", \"Male\", \"female\", which need to be standardized, for example, to \"M\" and \"F\".*\n", - "- *State abbreviations be can replaced with its full name, for example \"AZ\": \"Arizona\", \"Cali\": \"California\", \"WA\": \"Washington\"*\n", - "- *In education, \"Bachelors\" could be replaced by \"Bachelor\"*\n", - "- *In Customer Lifetime Value, delete the `%` character*\n", - "- *In vehicle class, \"Sports Car\", \"Luxury SUV\" and \"Luxury Car\" could be replaced by \"Luxury\"*" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3f8ee5cb-50ab-48af-8a9f-9a389804033c", - "metadata": { - "id": "3f8ee5cb-50ab-48af-8a9f-9a389804033c" - }, - "outputs": [], - "source": [ - "# Your code here" - ] - }, - { - "cell_type": "markdown", - "id": "85ff78ce-0174-4890-9db3-8048b7d7d2d0", - "metadata": { - "id": "85ff78ce-0174-4890-9db3-8048b7d7d2d0" - }, - "source": [ - "## Exercise 3: Formatting data types" - ] - }, - { - "cell_type": "markdown", - "id": "b91c2cf8-79a2-4baf-9f65-ff2fb22270bd", - "metadata": { - "id": "b91c2cf8-79a2-4baf-9f65-ff2fb22270bd" - }, - "source": [ - "The data types of many columns in the dataset appear to be incorrect. This could impact the accuracy of our analysis. To ensure accurate analysis, we need to correct the data types of these columns. Please update the data types of the columns as appropriate." - ] - }, - { - "cell_type": "markdown", - "id": "43e5d853-ff9e-43b2-9d92-aef2f78764f3", - "metadata": { - "id": "43e5d853-ff9e-43b2-9d92-aef2f78764f3" - }, - "source": [ - "It is important to note that this exercise does not involve handling null values (NaN or None)." - ] - }, - { - "cell_type": "markdown", - "id": "329ca691-9196-4419-8969-3596746237a1", - "metadata": { - "id": "329ca691-9196-4419-8969-3596746237a1" - }, - "source": [ - "*Hint*:\n", - "- *Customer lifetime value should be numeric*\n", - "- *Number of open complaints has an incorrect format. Look at the different values it takes with `unique()` and take the middle value. As an example, 1/5/00 should be 5. Number of open complaints is a string - remember you can use `split()` to deal with it and take the number you need. Finally, since it should be numeric, cast the column to be in its proper type.*" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "eb8f5991-73e9-405f-bf1c-6b7c589379a9", - "metadata": { - "id": "eb8f5991-73e9-405f-bf1c-6b7c589379a9" - }, - "outputs": [], - "source": [ - "# Your code here" - ] - }, - { - "cell_type": "markdown", - "id": "14c52e28-2d0c-4dd2-8bd5-3476e34fadc1", - "metadata": { - "id": "14c52e28-2d0c-4dd2-8bd5-3476e34fadc1" - }, - "source": [ - "## Exercise 4: Dealing with Null values" - ] - }, - { - "cell_type": "markdown", - "id": "34b9a20f-7d32-4417-975e-1b4dfb0e16cd", - "metadata": { - "id": "34b9a20f-7d32-4417-975e-1b4dfb0e16cd" - }, - "source": [ - "Identify any columns with null or missing values. Identify how many null values each column has. You can use the `isnull()` function in pandas to find columns with null values.\n", - "\n", - "Decide on a strategy for handling the null values. There are several options, including:\n", - "\n", - "- Drop the rows or columns with null values\n", - "- Fill the null values with a specific value (such as the column mean or median for numerical variables, and mode for categorical variables)\n", - "- Fill the null values with the previous or next value in the column\n", - "- Fill the null values based on a more complex algorithm or model (note: we haven't covered this yet)\n", - "\n", - "Implement your chosen strategy to handle the null values. You can use the `fillna()` function in pandas to fill null values or `dropna()` function to drop null values.\n", - "\n", - "Verify that your strategy has successfully handled the null values. You can use the `isnull()` function again to check if there are still null values in the dataset.\n", - "\n", - "Remember to document your process and explain your reasoning for choosing a particular strategy for handling null values.\n", - "\n", - "After formatting data types, as a last step, convert all the numeric variables to integers." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f184fc35-7831-4836-a0a5-e7f99e01b40e", - "metadata": { - "id": "f184fc35-7831-4836-a0a5-e7f99e01b40e" - }, - "outputs": [], - "source": [ - "# Your code here" - ] - }, - { - "cell_type": "markdown", - "id": "98416351-e999-4156-9834-9b00a311adfa", - "metadata": { - "id": "98416351-e999-4156-9834-9b00a311adfa" - }, - "source": [ - "## Exercise 5: Dealing with duplicates" - ] - }, + "cells": [ + { + "cell_type": "markdown", + "id": "25d7736c-ba17-4aff-b6bb-66eba20fbf4e", + "metadata": { + "id": "25d7736c-ba17-4aff-b6bb-66eba20fbf4e" + }, + "source": [ + "# Lab | Data Cleaning and Formatting" + ] + }, + { + "cell_type": "markdown", + "id": "d1973e9e-8be6-4039-b70e-d73ee0d94c99", + "metadata": { + "id": "d1973e9e-8be6-4039-b70e-d73ee0d94c99" + }, + "source": [ + "In this lab, we will be working with the customer data from an insurance company, which can be found in the CSV file located at the following link: https://raw.githubusercontent.com/data-bootcamp-v4/data/main/file1.csv\n" + ] + }, + { + "cell_type": "markdown", + "id": "31b8a9e7-7db9-4604-991b-ef6771603e57", + "metadata": { + "id": "31b8a9e7-7db9-4604-991b-ef6771603e57" + }, + "source": [ + "# Challenge 1: Data Cleaning and Formatting" + ] + }, + { + "cell_type": "markdown", + "id": "81553f19-9f2c-484b-8940-520aff884022", + "metadata": { + "id": "81553f19-9f2c-484b-8940-520aff884022" + }, + "source": [ + "## Exercise 1: Cleaning Column Names" + ] + }, + { + "cell_type": "markdown", + "id": "34a929f4-1be4-4fa8-adda-42ffd920be90", + "metadata": { + "id": "34a929f4-1be4-4fa8-adda-42ffd920be90" + }, + "source": [ + "To ensure consistency and ease of use, standardize the column names of the dataframe. Start by taking a first look at the dataframe and identifying any column names that need to be modified. Use appropriate naming conventions and make sure that column names are descriptive and informative.\n", + "\n", + "*Hint*:\n", + "- *Column names should be in lower case*\n", + "- *White spaces in column names should be replaced by `_`*\n", + "- *`st` could be replaced for `state`*" + ] + }, + { + "cell_type": "code", + "execution_count": 131, + "id": "5810735c-8056-4442-bbf2-dda38d3e284a", + "metadata": { + "id": "5810735c-8056-4442-bbf2-dda38d3e284a" + }, + "outputs": [ { - "cell_type": "markdown", - "id": "ea0816a7-a18e-4d4c-b667-a8452a800bd1", - "metadata": { - "id": "ea0816a7-a18e-4d4c-b667-a8452a800bd1" - }, - "source": [ - "Use the `.duplicated()` method to identify any duplicate rows in the dataframe.\n", - "\n", - "Decide on a strategy for handling the duplicates. Options include:\n", - "- Dropping all duplicate rows\n", - "- Keeping only the first occurrence of each duplicated row\n", - "- Keeping only the last occurrence of each duplicated row\n", - "- Dropping duplicates based on a subset of columns\n", - "- Dropping duplicates based on a specific column\n", - "\n", - "Implement your chosen strategy using the `drop_duplicates()` function.\n", - "\n", - "Verify that your strategy has successfully handled the duplicates by checking for duplicates again using `.duplicated()`.\n", - "\n", - "Remember to document your process and explain your reasoning for choosing a particular strategy for handling duplicates.\n", - "\n", - "Save the cleaned dataset to a new CSV file.\n", - "\n", - "*Hint*: *after dropping duplicates, reset the index to ensure consistency*." + "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", + "
customerstategendereducationcustomer_lifetime_valueincomemonthly_premium_autonumber_of_open_complaintspolicy_typevehicle_classtotal_claim_amount
0RB50392WashingtonNaNMasterNaN0.01000.01/0/00Personal AutoFour-Door Car2.704934
1QZ44356ArizonaFBachelor697953.59%0.094.01/0/00Personal AutoFour-Door Car1131.464935
2AI49188NevadaFBachelor1288743.17%48767.0108.01/0/00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniaMBachelor764586.18%0.0106.01/0/00Corporate AutoSUV529.881344
4GA49547WashingtonMHigh School or Below536307.65%36357.068.01/0/00Personal AutoFour-Door Car17.269323
....................................
4003NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4004NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4005NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4006NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4007NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", + "

4008 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education \\\n", + "0 RB50392 Washington NaN Master \n", + "1 QZ44356 Arizona F Bachelor \n", + "2 AI49188 Nevada F Bachelor \n", + "3 WW63253 California M Bachelor \n", + "4 GA49547 Washington M High School or Below \n", + "... ... ... ... ... \n", + "4003 NaN NaN NaN NaN \n", + "4004 NaN NaN NaN NaN \n", + "4005 NaN NaN NaN NaN \n", + "4006 NaN NaN NaN NaN \n", + "4007 NaN NaN NaN NaN \n", + "\n", + " customer_lifetime_value income monthly_premium_auto \\\n", + "0 NaN 0.0 1000.0 \n", + "1 697953.59% 0.0 94.0 \n", + "2 1288743.17% 48767.0 108.0 \n", + "3 764586.18% 0.0 106.0 \n", + "4 536307.65% 36357.0 68.0 \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " number_of_open_complaints policy_type vehicle_class \\\n", + "0 1/0/00 Personal Auto Four-Door Car \n", + "1 1/0/00 Personal Auto Four-Door Car \n", + "2 1/0/00 Personal Auto Two-Door Car \n", + "3 1/0/00 Corporate Auto SUV \n", + "4 1/0/00 Personal Auto Four-Door Car \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " total_claim_amount \n", + "0 2.704934 \n", + "1 1131.464935 \n", + "2 566.472247 \n", + "3 529.881344 \n", + "4 17.269323 \n", + "... ... \n", + "4003 NaN \n", + "4004 NaN \n", + "4005 NaN \n", + "4006 NaN \n", + "4007 NaN \n", + "\n", + "[4008 rows x 11 columns]" ] - }, + }, + "execution_count": 131, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "url = \"https://raw.githubusercontent.com/data-bootcamp-v4/data/main/file1.csv\"\n", + "\n", + "import pandas as pd\n", + "df = pd.read_csv(url)\n", + "\n", + "def clean_columns(df):\n", + " df.columns = (\n", + " df.columns\n", + " .str.lower()\n", + " .str.replace(\" \",\"_\")\n", + " \n", + " )\n", + "\n", + " return df\n", + "df = clean_columns(df)\n", + "\n", + "df.rename(columns= {'st': 'state'}, inplace = True)\n", + "\n", + "df\n", + " " + ] + }, + { + "cell_type": "markdown", + "id": "9cb501ec-36ff-4589-b872-6252bb150316", + "metadata": { + "id": "9cb501ec-36ff-4589-b872-6252bb150316" + }, + "source": [ + "## Exercise 2: Cleaning invalid Values" + ] + }, + { + "cell_type": "markdown", + "id": "771fdcf3-8e20-4b06-9c24-3a93ba2b0909", + "metadata": { + "id": "771fdcf3-8e20-4b06-9c24-3a93ba2b0909" + }, + "source": [ + "The dataset contains columns with inconsistent and incorrect values that could affect the accuracy of our analysis. Therefore, we need to clean these columns to ensure that they only contain valid data.\n", + "\n", + "Note that this exercise will focus only on cleaning inconsistent values and will not involve handling null values (NaN or None).\n", + "\n", + "*Hint*:\n", + "- *Gender column contains various inconsistent values such as \"F\", \"M\", \"Femal\", \"Male\", \"female\", which need to be standardized, for example, to \"M\" and \"F\".*\n", + "- *State abbreviations be can replaced with its full name, for example \"AZ\": \"Arizona\", \"Cali\": \"California\", \"WA\": \"Washington\"*\n", + "- *In education, \"Bachelors\" could be replaced by \"Bachelor\"*\n", + "- *In Customer Lifetime Value, delete the `%` character*\n", + "- *In vehicle class, \"Sports Car\", \"Luxury SUV\" and \"Luxury Car\" could be replaced by \"Luxury\"*" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "d2a1c74f-e3e2-43db-bcdf-50ff88369d92", + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "execution_count": null, - "id": "1929362c-47ed-47cb-baca-358b78d401a0", - "metadata": { - "id": "1929362c-47ed-47cb-baca-358b78d401a0" - }, - "outputs": [], - "source": [ - "# Your code here" + "data": { + "text/plain": [ + "array(['Washington', 'Arizona', 'Nevada', 'California', 'Oregon', 'Cali',\n", + " 'AZ', 'WA', nan], dtype=object)" ] - }, + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['state'].unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "3f8ee5cb-50ab-48af-8a9f-9a389804033c", + "metadata": { + "id": "3f8ee5cb-50ab-48af-8a9f-9a389804033c" + }, + "outputs": [ { - "cell_type": "markdown", - "id": "60840701-4783-40e2-b4d8-55303f9100c9", - "metadata": { - "id": "60840701-4783-40e2-b4d8-55303f9100c9" - }, - "source": [ - "# Bonus: Challenge 2: creating functions on a separate `py` file" + "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", + "
customerstategendereducationcustomer_lifetime_valueincomemonthly_premium_autonumber_of_open_complaintspolicy_typevehicle_classtotal_claim_amount
0RB50392WashingtonNaNMasterNaN0.01000.01/0/00Personal AutoFour-Door Car2.704934
1QZ44356ArizonafemaleBachelor697953.59%0.094.01/0/00Personal AutoFour-Door Car1131.464935
2AI49188NevadafemaleBachelor1288743.17%48767.0108.01/0/00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniamaleBachelor764586.18%0.0106.01/0/00Corporate AutoSUV529.881344
4GA49547WashingtonmaleHigh School or Below536307.65%36357.068.01/0/00Personal AutoFour-Door Car17.269323
....................................
4003NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4004NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4005NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4006NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4007NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", + "

4008 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education \\\n", + "0 RB50392 Washington NaN Master \n", + "1 QZ44356 Arizona female Bachelor \n", + "2 AI49188 Nevada female Bachelor \n", + "3 WW63253 California male Bachelor \n", + "4 GA49547 Washington male High School or Below \n", + "... ... ... ... ... \n", + "4003 NaN NaN NaN NaN \n", + "4004 NaN NaN NaN NaN \n", + "4005 NaN NaN NaN NaN \n", + "4006 NaN NaN NaN NaN \n", + "4007 NaN NaN NaN NaN \n", + "\n", + " customer_lifetime_value income monthly_premium_auto \\\n", + "0 NaN 0.0 1000.0 \n", + "1 697953.59% 0.0 94.0 \n", + "2 1288743.17% 48767.0 108.0 \n", + "3 764586.18% 0.0 106.0 \n", + "4 536307.65% 36357.0 68.0 \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " number_of_open_complaints policy_type vehicle_class \\\n", + "0 1/0/00 Personal Auto Four-Door Car \n", + "1 1/0/00 Personal Auto Four-Door Car \n", + "2 1/0/00 Personal Auto Two-Door Car \n", + "3 1/0/00 Corporate Auto SUV \n", + "4 1/0/00 Personal Auto Four-Door Car \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " total_claim_amount \n", + "0 2.704934 \n", + "1 1131.464935 \n", + "2 566.472247 \n", + "3 529.881344 \n", + "4 17.269323 \n", + "... ... \n", + "4003 NaN \n", + "4004 NaN \n", + "4005 NaN \n", + "4006 NaN \n", + "4007 NaN \n", + "\n", + "[4008 rows x 11 columns]" ] - }, + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['gender'] = df['gender'].apply( lambda x: ('male' if x[0].lower() == 'm' else 'female') if isinstance(x, str) else x)\n", + "df" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "f3de77fa-38c6-40d8-a7be-2ec662b03832", + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "id": "9d1adb3a-17cf-4899-8041-da21a4337fb4", - "metadata": { - "id": "9d1adb3a-17cf-4899-8041-da21a4337fb4" - }, - "source": [ - "Put all the data cleaning and formatting steps into functions, and create a main function that performs all the cleaning and formatting.\n", - "\n", - "Write these functions in separate .py file(s). By putting these steps into functions, we can make the code more modular and easier to maintain." + "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", + "
customerstategendereducationcustomer_lifetime_valueincomemonthly_premium_autonumber_of_open_complaintspolicy_typevehicle_classtotal_claim_amount
0RB50392WashingtonNaNMasterNaN0.01000.01/0/00Personal AutoFour-Door Car2.704934
1QZ44356ArizonafemaleBachelor697953.59%0.094.01/0/00Personal AutoFour-Door Car1131.464935
2AI49188NevadafemaleBachelor1288743.17%48767.0108.01/0/00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniamaleBachelor764586.18%0.0106.01/0/00Corporate AutoSUV529.881344
4GA49547WashingtonmaleHigh School or Below536307.65%36357.068.01/0/00Personal AutoFour-Door Car17.269323
....................................
4003NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4004NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4005NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4006NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4007NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", + "

4008 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education \\\n", + "0 RB50392 Washington NaN Master \n", + "1 QZ44356 Arizona female Bachelor \n", + "2 AI49188 Nevada female Bachelor \n", + "3 WW63253 California male Bachelor \n", + "4 GA49547 Washington male High School or Below \n", + "... ... ... ... ... \n", + "4003 NaN NaN NaN NaN \n", + "4004 NaN NaN NaN NaN \n", + "4005 NaN NaN NaN NaN \n", + "4006 NaN NaN NaN NaN \n", + "4007 NaN NaN NaN NaN \n", + "\n", + " customer_lifetime_value income monthly_premium_auto \\\n", + "0 NaN 0.0 1000.0 \n", + "1 697953.59% 0.0 94.0 \n", + "2 1288743.17% 48767.0 108.0 \n", + "3 764586.18% 0.0 106.0 \n", + "4 536307.65% 36357.0 68.0 \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " number_of_open_complaints policy_type vehicle_class \\\n", + "0 1/0/00 Personal Auto Four-Door Car \n", + "1 1/0/00 Personal Auto Four-Door Car \n", + "2 1/0/00 Personal Auto Two-Door Car \n", + "3 1/0/00 Corporate Auto SUV \n", + "4 1/0/00 Personal Auto Four-Door Car \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " total_claim_amount \n", + "0 2.704934 \n", + "1 1131.464935 \n", + "2 566.472247 \n", + "3 529.881344 \n", + "4 17.269323 \n", + "... ... \n", + "4003 NaN \n", + "4004 NaN \n", + "4005 NaN \n", + "4006 NaN \n", + "4007 NaN \n", + "\n", + "[4008 rows x 11 columns]" ] - }, + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "def replace_st_abbreviations(state):\n", + " \n", + " if state == 'Cali':\n", + " return 'California'\n", + " elif state == 'AZ':\n", + " return 'Arizona'\n", + " elif state == 'WA':\n", + " return 'Washington'\n", + " else:\n", + " return state\n", + "\n", + "df['state'] = df['state'].apply(replace_st_abbreviations)\n", + "\n", + "df\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "d6dd0313-0293-4b3e-87c0-e318083b9ee8", + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "id": "0e170dc2-b62c-417a-8248-e63ed18a70c4", - "metadata": { - "id": "0e170dc2-b62c-417a-8248-e63ed18a70c4" - }, - "source": [ - "*Hint: autoreload module is a utility module in Python that allows you to automatically reload modules in the current session when changes are made to the source code. This can be useful in situations where you are actively developing code and want to see the effects of changes you make without having to constantly restart the Python interpreter or Jupyter Notebook kernel.*" + "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", + "
customerstategendereducationcustomer_lifetime_valueincomemonthly_premium_autonumber_of_open_complaintspolicy_typevehicle_classtotal_claim_amount
0RB50392WashingtonNaNMasterNaN0.01000.01/0/00Personal AutoFour-Door Car2.704934
1QZ44356ArizonafemaleBachelor697953.59%0.094.01/0/00Personal AutoFour-Door Car1131.464935
2AI49188NevadafemaleBachelor1288743.17%48767.0108.01/0/00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniamaleBachelor764586.18%0.0106.01/0/00Corporate AutoSUV529.881344
4GA49547WashingtonmaleHigh School or Below536307.65%36357.068.01/0/00Personal AutoFour-Door Car17.269323
....................................
4003NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4004NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4005NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4006NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4007NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", + "

4008 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education \\\n", + "0 RB50392 Washington NaN Master \n", + "1 QZ44356 Arizona female Bachelor \n", + "2 AI49188 Nevada female Bachelor \n", + "3 WW63253 California male Bachelor \n", + "4 GA49547 Washington male High School or Below \n", + "... ... ... ... ... \n", + "4003 NaN NaN NaN NaN \n", + "4004 NaN NaN NaN NaN \n", + "4005 NaN NaN NaN NaN \n", + "4006 NaN NaN NaN NaN \n", + "4007 NaN NaN NaN NaN \n", + "\n", + " customer_lifetime_value income monthly_premium_auto \\\n", + "0 NaN 0.0 1000.0 \n", + "1 697953.59% 0.0 94.0 \n", + "2 1288743.17% 48767.0 108.0 \n", + "3 764586.18% 0.0 106.0 \n", + "4 536307.65% 36357.0 68.0 \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " number_of_open_complaints policy_type vehicle_class \\\n", + "0 1/0/00 Personal Auto Four-Door Car \n", + "1 1/0/00 Personal Auto Four-Door Car \n", + "2 1/0/00 Personal Auto Two-Door Car \n", + "3 1/0/00 Corporate Auto SUV \n", + "4 1/0/00 Personal Auto Four-Door Car \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " total_claim_amount \n", + "0 2.704934 \n", + "1 1131.464935 \n", + "2 566.472247 \n", + "3 529.881344 \n", + "4 17.269323 \n", + "... ... \n", + "4003 NaN \n", + "4004 NaN \n", + "4005 NaN \n", + "4006 NaN \n", + "4007 NaN \n", + "\n", + "[4008 rows x 11 columns]" ] - }, + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['education'] = df['education'].apply( lambda x: 'Bachelor' if x == 'Bachelors' else x)\n", + "\n", + "df" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "ade742f6-5637-4c67-b48d-61bec5455b6a", + "metadata": {}, + "outputs": [ { - "cell_type": "code", - "execution_count": null, - "id": "a52c6dfc-cd11-4d01-bda4-f719fa33e9a4", - "metadata": { - "id": "a52c6dfc-cd11-4d01-bda4-f719fa33e9a4" - }, - "outputs": [], - "source": [ - "# Your code here" + "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", + "
customerstategendereducationcustomer_lifetime_valueincomemonthly_premium_autonumber_of_open_complaintspolicy_typevehicle_classtotal_claim_amount
0RB50392WashingtonNaNMasterNaN0.01000.01/0/00Personal AutoFour-Door Car2.704934
1QZ44356ArizonafemaleBachelor697953.590.094.01/0/00Personal AutoFour-Door Car1131.464935
2AI49188NevadafemaleBachelor1288743.1748767.0108.01/0/00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniamaleBachelor764586.180.0106.01/0/00Corporate AutoSUV529.881344
4GA49547WashingtonmaleHigh School or Below536307.6536357.068.01/0/00Personal AutoFour-Door Car17.269323
....................................
4003NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4004NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4005NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4006NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4007NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", + "

4008 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education \\\n", + "0 RB50392 Washington NaN Master \n", + "1 QZ44356 Arizona female Bachelor \n", + "2 AI49188 Nevada female Bachelor \n", + "3 WW63253 California male Bachelor \n", + "4 GA49547 Washington male High School or Below \n", + "... ... ... ... ... \n", + "4003 NaN NaN NaN NaN \n", + "4004 NaN NaN NaN NaN \n", + "4005 NaN NaN NaN NaN \n", + "4006 NaN NaN NaN NaN \n", + "4007 NaN NaN NaN NaN \n", + "\n", + " customer_lifetime_value income monthly_premium_auto \\\n", + "0 NaN 0.0 1000.0 \n", + "1 697953.59 0.0 94.0 \n", + "2 1288743.17 48767.0 108.0 \n", + "3 764586.18 0.0 106.0 \n", + "4 536307.65 36357.0 68.0 \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " number_of_open_complaints policy_type vehicle_class \\\n", + "0 1/0/00 Personal Auto Four-Door Car \n", + "1 1/0/00 Personal Auto Four-Door Car \n", + "2 1/0/00 Personal Auto Two-Door Car \n", + "3 1/0/00 Corporate Auto SUV \n", + "4 1/0/00 Personal Auto Four-Door Car \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " total_claim_amount \n", + "0 2.704934 \n", + "1 1131.464935 \n", + "2 566.472247 \n", + "3 529.881344 \n", + "4 17.269323 \n", + "... ... \n", + "4003 NaN \n", + "4004 NaN \n", + "4005 NaN \n", + "4006 NaN \n", + "4007 NaN \n", + "\n", + "[4008 rows x 11 columns]" ] - }, + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['customer_lifetime_value'] = df['customer_lifetime_value'].str.replace(\"%\", \" \").astype(float)\n", + "df" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "8f432553-1a68-4801-9a26-c502a7025e57", + "metadata": {}, + "outputs": [ { - "cell_type": "markdown", - "id": "80f846bb-3f5e-4ca2-96c0-900728daca5a", - "metadata": { - "tags": [], - "id": "80f846bb-3f5e-4ca2-96c0-900728daca5a" - }, - "source": [ - "# Bonus: Challenge 3: Analyzing Clean and Formated Data" + "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", + "
customerstategendereducationcustomer_lifetime_valueincomemonthly_premium_autonumber_of_open_complaintspolicy_typevehicle_classtotal_claim_amount
0RB50392WashingtonNaNMasterNaN0.01000.01/0/00Personal AutoFour-Door Car2.704934
1QZ44356ArizonafemaleBachelor697953.590.094.01/0/00Personal AutoFour-Door Car1131.464935
2AI49188NevadafemaleBachelor1288743.1748767.0108.01/0/00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniamaleBachelor764586.180.0106.01/0/00Corporate AutoSUV529.881344
4GA49547WashingtonmaleHigh School or Below536307.6536357.068.01/0/00Personal AutoFour-Door Car17.269323
\n", + "
" + ], + "text/plain": [ + " customer state gender education customer_lifetime_value \\\n", + "0 RB50392 Washington NaN Master NaN \n", + "1 QZ44356 Arizona female Bachelor 697953.59 \n", + "2 AI49188 Nevada female Bachelor 1288743.17 \n", + "3 WW63253 California male Bachelor 764586.18 \n", + "4 GA49547 Washington male High School or Below 536307.65 \n", + "\n", + " income monthly_premium_auto number_of_open_complaints policy_type \\\n", + "0 0.0 1000.0 1/0/00 Personal Auto \n", + "1 0.0 94.0 1/0/00 Personal Auto \n", + "2 48767.0 108.0 1/0/00 Personal Auto \n", + "3 0.0 106.0 1/0/00 Corporate Auto \n", + "4 36357.0 68.0 1/0/00 Personal Auto \n", + "\n", + " vehicle_class total_claim_amount \n", + "0 Four-Door Car 2.704934 \n", + "1 Four-Door Car 1131.464935 \n", + "2 Two-Door Car 566.472247 \n", + "3 SUV 529.881344 \n", + "4 Four-Door Car 17.269323 " ] - }, + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['vehicle_class'] = df['vehicle_class'].apply (lambda x: 'Luxury' if x in [\"Sports Car\", \"Luxury SUV\", \"Luxury Car\"] else x)\n", + "df.head()" + ] + }, + { + "cell_type": "markdown", + "id": "85ff78ce-0174-4890-9db3-8048b7d7d2d0", + "metadata": { + "id": "85ff78ce-0174-4890-9db3-8048b7d7d2d0" + }, + "source": [ + "## Exercise 3: Formatting data types" + ] + }, + { + "cell_type": "markdown", + "id": "b91c2cf8-79a2-4baf-9f65-ff2fb22270bd", + "metadata": { + "id": "b91c2cf8-79a2-4baf-9f65-ff2fb22270bd" + }, + "source": [ + "The data types of many columns in the dataset appear to be incorrect. This could impact the accuracy of our analysis. To ensure accurate analysis, we need to correct the data types of these columns. Please update the data types of the columns as appropriate." + ] + }, + { + "cell_type": "markdown", + "id": "43e5d853-ff9e-43b2-9d92-aef2f78764f3", + "metadata": { + "id": "43e5d853-ff9e-43b2-9d92-aef2f78764f3" + }, + "source": [ + "It is important to note that this exercise does not involve handling null values (NaN or None)." + ] + }, + { + "cell_type": "markdown", + "id": "329ca691-9196-4419-8969-3596746237a1", + "metadata": { + "id": "329ca691-9196-4419-8969-3596746237a1" + }, + "source": [ + "*Hint*:\n", + "- *Customer lifetime value should be numeric*\n", + "- *Number of open complaints has an incorrect format. Look at the different values it takes with `unique()` and take the middle value. As an example, 1/5/00 should be 5. Number of open complaints is a string - remember you can use `split()` to deal with it and take the number you need. Finally, since it should be numeric, cast the column to be in its proper type.*" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "eb8f5991-73e9-405f-bf1c-6b7c589379a9", + "metadata": { + "id": "eb8f5991-73e9-405f-bf1c-6b7c589379a9" + }, + "outputs": [ { - "cell_type": "markdown", - "id": "9021630e-cc90-446c-b5bd-264d6c864207", - "metadata": { - "id": "9021630e-cc90-446c-b5bd-264d6c864207" - }, - "source": [ - "You have been tasked with analyzing the data to identify potential areas for improving customer retention and profitability. Your goal is to identify customers with a high policy claim amount and a low customer lifetime value.\n", - "\n", - "In the Pandas Lab, we only looked at high policy claim amounts because we couldn't look into low customer lifetime values. If we had tried to work with that column, we wouldn't have been able to because customer lifetime value wasn't clean and in its proper format. So after cleaning and formatting the data, let's get some more interesting insights!\n", - "\n", - "Instructions:\n", - "\n", - "- Review the statistics again for total claim amount and customer lifetime value to gain an understanding of the data.\n", - "- To identify potential areas for improving customer retention and profitability, we want to focus on customers with a high policy claim amount and a low customer lifetime value. Consider customers with a high policy claim amount to be those in the top 25% of the total claim amount, and clients with a low customer lifetime value to be those in the bottom 25% of the customer lifetime value. Create a pandas DataFrame object that contains information about customers with a policy claim amount greater than the 75th percentile and a customer lifetime value in the bottom 25th percentile.\n", - "- Use DataFrame methods to calculate summary statistics about the high policy claim amount and low customer lifetime value data. To do so, select both columns of the dataframe simultaneously and pass it to the `.describe()` method. This will give you descriptive statistics, such as mean, median, standard deviation, minimum and maximum values for both columns at the same time, allowing you to compare and analyze their characteristics." - ] + "name": "stdout", + "output_type": "stream", + "text": [ + "['1/0/00' '1/2/00' '1/1/00' '1/3/00' '1/5/00' '1/4/00' nan]\n" + ] }, { - "cell_type": "code", - "execution_count": null, - "id": "211e82b5-461a-4d6f-8a23-4deccb84173c", - "metadata": { - "id": "211e82b5-461a-4d6f-8a23-4deccb84173c" - }, - "outputs": [], - "source": [ - "# Your code here" + "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", + "
customerstategendereducationcustomer_lifetime_valueincomemonthly_premium_autonumber_of_open_complaintspolicy_typevehicle_classtotal_claim_amount
0RB50392WashingtonNaNMasterNaN0.01000.00Personal AutoFour-Door Car2.704934
1QZ44356ArizonafemaleBachelor697953.590.094.00Personal AutoFour-Door Car1131.464935
2AI49188NevadafemaleBachelor1288743.1748767.0108.00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniamaleBachelor764586.180.0106.00Corporate AutoSUV529.881344
4GA49547WashingtonmaleHigh School or Below536307.6536357.068.00Personal AutoFour-Door Car17.269323
....................................
4003NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4004NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4005NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4006NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
4007NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", + "

4008 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education \\\n", + "0 RB50392 Washington NaN Master \n", + "1 QZ44356 Arizona female Bachelor \n", + "2 AI49188 Nevada female Bachelor \n", + "3 WW63253 California male Bachelor \n", + "4 GA49547 Washington male High School or Below \n", + "... ... ... ... ... \n", + "4003 NaN NaN NaN NaN \n", + "4004 NaN NaN NaN NaN \n", + "4005 NaN NaN NaN NaN \n", + "4006 NaN NaN NaN NaN \n", + "4007 NaN NaN NaN NaN \n", + "\n", + " customer_lifetime_value income monthly_premium_auto \\\n", + "0 NaN 0.0 1000.0 \n", + "1 697953.59 0.0 94.0 \n", + "2 1288743.17 48767.0 108.0 \n", + "3 764586.18 0.0 106.0 \n", + "4 536307.65 36357.0 68.0 \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " number_of_open_complaints policy_type vehicle_class \\\n", + "0 0 Personal Auto Four-Door Car \n", + "1 0 Personal Auto Four-Door Car \n", + "2 0 Personal Auto Two-Door Car \n", + "3 0 Corporate Auto SUV \n", + "4 0 Personal Auto Four-Door Car \n", + "... ... ... ... \n", + "4003 NaN NaN NaN \n", + "4004 NaN NaN NaN \n", + "4005 NaN NaN NaN \n", + "4006 NaN NaN NaN \n", + "4007 NaN NaN NaN \n", + "\n", + " total_claim_amount \n", + "0 2.704934 \n", + "1 1131.464935 \n", + "2 566.472247 \n", + "3 529.881344 \n", + "4 17.269323 \n", + "... ... \n", + "4003 NaN \n", + "4004 NaN \n", + "4005 NaN \n", + "4006 NaN \n", + "4007 NaN \n", + "\n", + "[4008 rows x 11 columns]" ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.13" - }, - "colab": { - "provenance": [] + ], + "source": [ + "df['customer_lifetime_value'].astype(float)\n", + "df['number_of_open_complaints'] = df['number_of_open_complaints'].str.split('/').str[1]\n", + "df['number_of_open_complaints'].astype(float)\n", + "df" + ] + }, + { + "cell_type": "markdown", + "id": "14c52e28-2d0c-4dd2-8bd5-3476e34fadc1", + "metadata": { + "id": "14c52e28-2d0c-4dd2-8bd5-3476e34fadc1" + }, + "source": [ + "## Exercise 4: Dealing with Null values" + ] + }, + { + "cell_type": "markdown", + "id": "34b9a20f-7d32-4417-975e-1b4dfb0e16cd", + "metadata": { + "id": "34b9a20f-7d32-4417-975e-1b4dfb0e16cd" + }, + "source": [ + "Identify any columns with null or missing values. Identify how many null values each column has. You can use the `isnull()` function in pandas to find columns with null values.\n", + "\n", + "Decide on a strategy for handling the null values. There are several options, including:\n", + "\n", + "- Drop the rows or columns with null values\n", + "- Fill the null values with a specific value (such as the column mean or median for numerical variables, and mode for categorical variables)\n", + "- Fill the null values with the previous or next value in the column\n", + "- Fill the null values based on a more complex algorithm or model (note: we haven't covered this yet)\n", + "\n", + "Implement your chosen strategy to handle the null values. You can use the `fillna()` function in pandas to fill null values or `dropna()` function to drop null values.\n", + "\n", + "Verify that your strategy has successfully handled the null values. You can use the `isnull()` function again to check if there are still null values in the dataset.\n", + "\n", + "Remember to document your process and explain your reasoning for choosing a particular strategy for handling null values.\n", + "\n", + "After formatting data types, as a last step, convert all the numeric variables to integers." + ] + }, + { + "cell_type": "code", + "execution_count": 94, + "id": "f184fc35-7831-4836-a0a5-e7f99e01b40e", + "metadata": { + "id": "f184fc35-7831-4836-a0a5-e7f99e01b40e" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Index: 952 entries, 1 to 1070\n", + "Data columns (total 11 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 customer 952 non-null object\n", + " 1 state 952 non-null object\n", + " 2 gender 952 non-null object\n", + " 3 education 952 non-null object\n", + " 4 customer_lifetime_value 952 non-null int64 \n", + " 5 income 952 non-null int64 \n", + " 6 monthly_premium_auto 952 non-null int64 \n", + " 7 number_of_open_complaints 952 non-null object\n", + " 8 policy_type 952 non-null object\n", + " 9 vehicle_class 952 non-null object\n", + " 10 total_claim_amount 952 non-null int64 \n", + "dtypes: int64(4), object(7)\n", + "memory usage: 89.2+ KB\n" + ] } + ], + "source": [ + "#The strategy for handling null values here should be to drop all the rows and columns\n", + "#with null values, because filling those with other specific values would corrupt the \n", + "#information of other clients. We cannot add the number of open complaints\n", + "#of one customer to the next one on the list, for example. \n", + "\n", + "df.dropna(inplace=True)\n", + "\n", + "df.isnull()\n", + "\n", + "df[['total_claim_amount', 'monthly_premium_auto', 'income', 'customer_lifetime_value']] = df[['total_claim_amount', 'monthly_premium_auto', 'income', 'customer_lifetime_value']].astype(int)\n", + "df.info()" + ] + }, + { + "cell_type": "markdown", + "id": "98416351-e999-4156-9834-9b00a311adfa", + "metadata": { + "id": "98416351-e999-4156-9834-9b00a311adfa" + }, + "source": [ + "## Exercise 5: Dealing with duplicates" + ] + }, + { + "cell_type": "markdown", + "id": "ea0816a7-a18e-4d4c-b667-a8452a800bd1", + "metadata": { + "id": "ea0816a7-a18e-4d4c-b667-a8452a800bd1" + }, + "source": [ + "Use the `.duplicated()` method to identify any duplicate rows in the dataframe.\n", + "\n", + "Decide on a strategy for handling the duplicates. Options include:\n", + "- Dropping all duplicate rows\n", + "- Keeping only the first occurrence of each duplicated row\n", + "- Keeping only the last occurrence of each duplicated row\n", + "- Dropping duplicates based on a subset of columns\n", + "- Dropping duplicates based on a specific column\n", + "\n", + "Implement your chosen strategy using the `drop_duplicates()` function.\n", + "\n", + "Verify that your strategy has successfully handled the duplicates by checking for duplicates again using `.duplicated()`.\n", + "\n", + "Remember to document your process and explain your reasoning for choosing a particular strategy for handling duplicates.\n", + "\n", + "Save the cleaned dataset to a new CSV file.\n", + "\n", + "*Hint*: *after dropping duplicates, reset the index to ensure consistency*." + ] + }, + { + "cell_type": "code", + "execution_count": 114, + "id": "1929362c-47ed-47cb-baca-358b78d401a0", + "metadata": { + "id": "1929362c-47ed-47cb-baca-358b78d401a0" + }, + "outputs": [], + "source": [ + "#Dropping all the duplicate values is also the best strategy in this case, as each row has a unique identifier (customer(ID))\n", + "#and there is no value in keeping duplicate values, as it would contaminate our data stats.\n", + "\n", + "df.drop_duplicates()\n", + "\n", + "df.to_csv('cleaned_insurance_comp_data_lab2.csv', index=False)\n" + ] + }, + { + "cell_type": "markdown", + "id": "60840701-4783-40e2-b4d8-55303f9100c9", + "metadata": { + "id": "60840701-4783-40e2-b4d8-55303f9100c9" + }, + "source": [ + "# Bonus: Challenge 2: creating functions on a separate `py` file" + ] + }, + { + "cell_type": "markdown", + "id": "9d1adb3a-17cf-4899-8041-da21a4337fb4", + "metadata": { + "id": "9d1adb3a-17cf-4899-8041-da21a4337fb4" + }, + "source": [ + "Put all the data cleaning and formatting steps into functions, and create a main function that performs all the cleaning and formatting.\n", + "\n", + "Write these functions in separate .py file(s). By putting these steps into functions, we can make the code more modular and easier to maintain." + ] + }, + { + "cell_type": "markdown", + "id": "0e170dc2-b62c-417a-8248-e63ed18a70c4", + "metadata": { + "id": "0e170dc2-b62c-417a-8248-e63ed18a70c4" + }, + "source": [ + "*Hint: autoreload module is a utility module in Python that allows you to automatically reload modules in the current session when changes are made to the source code. This can be useful in situations where you are actively developing code and want to see the effects of changes you make without having to constantly restart the Python interpreter or Jupyter Notebook kernel.*" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "a52c6dfc-cd11-4d01-bda4-f719fa33e9a4", + "metadata": { + "id": "a52c6dfc-cd11-4d01-bda4-f719fa33e9a4" + }, + "outputs": [], + "source": [ + "# Your code here" + ] + }, + { + "cell_type": "markdown", + "id": "80f846bb-3f5e-4ca2-96c0-900728daca5a", + "metadata": { + "id": "80f846bb-3f5e-4ca2-96c0-900728daca5a", + "tags": [] + }, + "source": [ + "# Bonus: Challenge 3: Analyzing Clean and Formated Data" + ] + }, + { + "cell_type": "markdown", + "id": "9021630e-cc90-446c-b5bd-264d6c864207", + "metadata": { + "id": "9021630e-cc90-446c-b5bd-264d6c864207" + }, + "source": [ + "You have been tasked with analyzing the data to identify potential areas for improving customer retention and profitability. Your goal is to identify customers with a high policy claim amount and a low customer lifetime value.\n", + "\n", + "In the Pandas Lab, we only looked at high policy claim amounts because we couldn't look into low customer lifetime values. If we had tried to work with that column, we wouldn't have been able to because customer lifetime value wasn't clean and in its proper format. So after cleaning and formatting the data, let's get some more interesting insights!\n", + "\n", + "Instructions:\n", + "\n", + "- Review the statistics again for total claim amount and customer lifetime value to gain an understanding of the data.\n", + "- To identify potential areas for improving customer retention and profitability, we want to focus on customers with a high policy claim amount and a low customer lifetime value. Consider customers with a high policy claim amount to be those in the top 25% of the total claim amount, and clients with a low customer lifetime value to be those in the bottom 25% of the customer lifetime value. Create a pandas DataFrame object that contains information about customers with a policy claim amount greater than the 75th percentile and a customer lifetime value in the bottom 25th percentile.\n", + "- Use DataFrame methods to calculate summary statistics about the high policy claim amount and low customer lifetime value data. To do so, select both columns of the dataframe simultaneously and pass it to the `.describe()` method. This will give you descriptive statistics, such as mean, median, standard deviation, minimum and maximum values for both columns at the same time, allowing you to compare and analyze their characteristics." + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "211e82b5-461a-4d6f-8a23-4deccb84173c", + "metadata": { + "id": "211e82b5-461a-4d6f-8a23-4deccb84173c" + }, + "outputs": [], + "source": [ + "# Your code here" + ] + } + ], + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" }, - "nbformat": 4, - "nbformat_minor": 5 + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 }