diff --git a/.DS_Store b/.DS_Store index 01222e6..c9e9a64 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.ipynb_checkpoints/lab-dw-data-structuring-and-combining-checkpoint.ipynb b/.ipynb_checkpoints/lab-dw-data-structuring-and-combining-checkpoint.ipynb new file mode 100644 index 0000000..ba31287 --- /dev/null +++ b/.ipynb_checkpoints/lab-dw-data-structuring-and-combining-checkpoint.ipynb @@ -0,0 +1,4568 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "25d7736c-ba17-4aff-b6bb-66eba20fbf4e", + "metadata": { + "id": "25d7736c-ba17-4aff-b6bb-66eba20fbf4e" + }, + "source": [ + "# Lab | Data Structuring and Combining Data" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fed098e8-fe86-4f29-9cf4-966166d2ba15", + "metadata": {}, + "outputs": [], + "source": [ + "# Concatenate the sales, and sales_2 vertically (along rows)\n", + "pd.concat([df_1, df_2], axis=0).reset_index(drop=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5597d7eb-fe95-4d8b-976f-5f82a0475029", + "metadata": {}, + "outputs": [], + "source": [ + "# If join='inner', only the overlapping columns are included in the result, and non-overlapping columns are exclude\n", + "pd.concat([df_1, df_2,], axis=0, join=\"inner\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b7c62056-9f1e-4484-b110-47579c280816", + "metadata": {}, + "outputs": [], + "source": [ + "# Merge the sales and revenue DataFrames on the 'Clumn_name' column (inner join)\n", + "# Only rows with a common value in the 'Date' column, present in both DataFrames, are included in the merged result.\n", + "pd.merge(df_1, df_2, on='Column_name')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "83a902d2-2a9c-442c-a902-3145c5a89101", + "metadata": {}, + "outputs": [], + "source": [ + "# If you want to perform an outer join, where all rows from both DataFrames are included, you can use how='outer'\n", + "pd.merge(df_1, df_2, on='Column_name', how='outer')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c222fd54-e744-4296-a3e0-8d246b0b9fa8", + "metadata": {}, + "outputs": [], + "source": [ + "# If you want to include all rows from the left DataFrame and only the matching rows from the right DataFrame, you can use `how='left'`.\n", + "pd.merge(df_1, df_2, on='Column_name', how='left')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fd5db744-e35d-47db-ab93-13d91a06a268", + "metadata": {}, + "outputs": [], + "source": [ + "# Similarly, if you want to include all rows from the right DataFrame and only the matching rows from the left DataFrame, you can use `how='right'`.\n", + "pd.merge(df_1, df_2, on='Column_name', how='right')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bc327990-e111-4326-be50-ac072da56d2f", + "metadata": {}, + "outputs": [], + "source": [ + "# join(): Combines DataFrames based on their indexes. It uses the index as the key to align the rows.\n", + "# to use join, we must set one \"Column_name\" as the index for all the tables to be joined.\n", + "df_1.set_index('Column_name', inplace=True)\n", + "df_2.set_index('Column_name', inplace=True)\n", + "# then\n", + "df_sales.join([df_1, df_2], how='inner or outer')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "83d11573-b75f-4c77-b4dc-b7d0e632af2d", + "metadata": {}, + "outputs": [], + "source": [ + "# PIVOT\n", + "df.pivot(index=\"Column_1\", columns=\"Column_2\", values=\"Column_3\")\n", + "\n", + "# when providing an aggregation function, place the values in a list:\n", + "pivot_df = df.pivot_table(index='Column_1', columns='Column_2', values=['Column_3'], aggfunc='sum')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cc171d78-333f-4653-bdbc-8ff9c780d02a", + "metadata": {}, + "outputs": [], + "source": [ + "# stack(): This method \"stacks\" the data, converting the columns into rows, and results in a multi-level index. It is useful when you have a DataFrame with multiple columns representing similar data, and you want to combine them into a single column.\n", + "# BUT FIRST: Create a multi-index DataFrame using set_index with the index columns of choice.\n", + "df_multiindex = df.set_index(['Column_1', 'Column_2'])\n", + "# then\n", + "stacked_data = df_multiindex.stack()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e65ff17e-91d0-4bc5-a146-fa4a0cfd0133", + "metadata": {}, + "outputs": [], + "source": [ + "# The melt() function in pandas is used to transform a DataFrame from a wide format to a long format, which is often more suitable for certain data analysis tasks.\n", + "# For example: Melt the DataFrame, keeping 'country' and 'year' as identifier variables, and 'Population' and 'GDP' as value variables\n", + "melted_data = pd.melt(df, id_vars=['country', 'year'], value_vars=['Population', 'GDP'], var_name='Indicator', value_name='Value')\n" + ] + }, + { + "cell_type": "markdown", + "id": "a2cdfc70-44c8-478c-81e7-2bc43fdf4986", + "metadata": { + "id": "a2cdfc70-44c8-478c-81e7-2bc43fdf4986" + }, + "source": [ + "## Challenge 1: Combining & Cleaning Data\n", + "\n", + "In this challenge, we will be working with the customer data from an insurance company, as we did in the two previous labs. The data can be found here:\n", + "- https://raw.githubusercontent.com/data-bootcamp-v4/data/main/file1.csv\n", + "\n", + "But this time, we got new data, which can be found in the following 2 CSV files located at the links below.\n", + "\n", + "- https://raw.githubusercontent.com/data-bootcamp-v4/data/main/file2.csv\n", + "- https://raw.githubusercontent.com/data-bootcamp-v4/data/main/file3.csv\n", + "\n", + "Note that you'll need to clean and format the new data.\n", + "\n", + "Observation:\n", + "- One option is to first combine the three datasets and then apply the cleaning function to the new combined dataset\n", + "- Another option would be to read the clean file you saved in the previous lab, and just clean the two new files and concatenate the three clean datasets" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "492d06e3-92c7-4105-ac72-536db98d3244", + "metadata": { + "id": "492d06e3-92c7-4105-ac72-536db98d3244" + }, + "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
0RB50392WashingtonUnknownMaster588174.2350.01000.00Personal AutoFour-Door Car2.704934
1QZ44356ArizonaFBachelor697953.5900.094.00Personal AutoFour-Door Car1131.464935
2AI49188NevadaFBachelor1288743.17048767.0108.00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniaMBachelor764586.1800.0106.00Corporate AutoSUV529.881344
4GA49547WashingtonMHigh School or Below536307.65036357.068.00Personal AutoFour-Door Car17.269323
....................................
1066TM65736OregonMMaster305955.03038644.078.01Personal AutoFour-Door Car361.455219
1067VJ51327CaliforniaFHigh School or Below2031499.76063209.0102.02Personal AutoSUV207.320041
1068GS98873ArizonaFBachelor323912.47016061.088.00Personal AutoFour-Door Car633.600000
1069CW49887CaliforniaFMaster462680.11079487.0114.00Special AutoSUV547.200000
1070MY31220CaliforniaFCollege899704.02054230.0112.00Personal AutoTwo-Door Car537.600000
\n", + "

1071 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education \\\n", + "0 RB50392 Washington Unknown 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", + "1066 TM65736 Oregon M Master \n", + "1067 VJ51327 California F High School or Below \n", + "1068 GS98873 Arizona F Bachelor \n", + "1069 CW49887 California F Master \n", + "1070 MY31220 California F College \n", + "\n", + " customer_lifetime_value income monthly_premium_auto \\\n", + "0 588174.235 0.0 1000.0 \n", + "1 697953.590 0.0 94.0 \n", + "2 1288743.170 48767.0 108.0 \n", + "3 764586.180 0.0 106.0 \n", + "4 536307.650 36357.0 68.0 \n", + "... ... ... ... \n", + "1066 305955.030 38644.0 78.0 \n", + "1067 2031499.760 63209.0 102.0 \n", + "1068 323912.470 16061.0 88.0 \n", + "1069 462680.110 79487.0 114.0 \n", + "1070 899704.020 54230.0 112.0 \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", + "1066 1 Personal Auto Four-Door Car \n", + "1067 2 Personal Auto SUV \n", + "1068 0 Personal Auto Four-Door Car \n", + "1069 0 Special Auto SUV \n", + "1070 0 Personal Auto Two-Door Car \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", + "1066 361.455219 \n", + "1067 207.320041 \n", + "1068 633.600000 \n", + "1069 547.200000 \n", + "1070 537.600000 \n", + "\n", + "[1071 rows x 11 columns]" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# first I import the cleaned data file from the first link, based on the work I did in the previous lab.\n", + "import pandas as pd\n", + "url = \"https://raw.githubusercontent.com/data-bootcamp-v4/data/main/file1.csv\"\n", + "insurance_company_1_df = pd.read_csv(\"insurance_company_cleaned.csv\")\n", + "insurance_company_1_df" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "b9650764-0e8b-444e-a08e-e822826227c7", + "metadata": { + "id": "492d06e3-92c7-4105-ac72-536db98d3244" + }, + "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", + "
CustomerSTGENDEREducationCustomer Lifetime ValueIncomeMonthly Premium AutoNumber of Open ComplaintsTotal Claim AmountPolicy TypeVehicle Class
0GS98873ArizonaFBachelor323912.47%16061881/0/00633.600000Personal AutoFour-Door Car
1CW49887CaliforniaFMaster462680.11%794871141/0/00547.200000Special AutoSUV
2MY31220CaliforniaFCollege899704.02%542301121/0/00537.600000Personal AutoTwo-Door Car
3UH35128OregonFCollege2580706.30%712102141/1/001027.200000Personal AutoLuxury Car
4WH52799ArizonaFCollege380812.21%94903941/0/00451.200000Corporate AutoTwo-Door Car
....................................
991HV85198ArizonaMMaster847141.75%63513701/0/00185.667213Personal AutoFour-Door Car
992BS91566ArizonaFCollege543121.91%58161681/0/00140.747286Corporate AutoFour-Door Car
993IL40123NevadaFCollege568964.41%83640701/0/00471.050488Corporate AutoTwo-Door Car
994MY32149CaliforniaFMaster368672.38%0961/0/0028.460568Personal AutoTwo-Door Car
995SA91515CaliforniaMBachelor399258.39%01111/0/00700.349052Personal AutoSUV
\n", + "

996 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " Customer ST GENDER Education Customer Lifetime Value Income \\\n", + "0 GS98873 Arizona F Bachelor 323912.47% 16061 \n", + "1 CW49887 California F Master 462680.11% 79487 \n", + "2 MY31220 California F College 899704.02% 54230 \n", + "3 UH35128 Oregon F College 2580706.30% 71210 \n", + "4 WH52799 Arizona F College 380812.21% 94903 \n", + ".. ... ... ... ... ... ... \n", + "991 HV85198 Arizona M Master 847141.75% 63513 \n", + "992 BS91566 Arizona F College 543121.91% 58161 \n", + "993 IL40123 Nevada F College 568964.41% 83640 \n", + "994 MY32149 California F Master 368672.38% 0 \n", + "995 SA91515 California M Bachelor 399258.39% 0 \n", + "\n", + " Monthly Premium Auto Number of Open Complaints Total Claim Amount \\\n", + "0 88 1/0/00 633.600000 \n", + "1 114 1/0/00 547.200000 \n", + "2 112 1/0/00 537.600000 \n", + "3 214 1/1/00 1027.200000 \n", + "4 94 1/0/00 451.200000 \n", + ".. ... ... ... \n", + "991 70 1/0/00 185.667213 \n", + "992 68 1/0/00 140.747286 \n", + "993 70 1/0/00 471.050488 \n", + "994 96 1/0/00 28.460568 \n", + "995 111 1/0/00 700.349052 \n", + "\n", + " Policy Type Vehicle Class \n", + "0 Personal Auto Four-Door Car \n", + "1 Special Auto SUV \n", + "2 Personal Auto Two-Door Car \n", + "3 Personal Auto Luxury Car \n", + "4 Corporate Auto Two-Door Car \n", + ".. ... ... \n", + "991 Personal Auto Four-Door Car \n", + "992 Corporate Auto Four-Door Car \n", + "993 Corporate Auto Two-Door Car \n", + "994 Personal Auto Two-Door Car \n", + "995 Personal Auto SUV \n", + "\n", + "[996 rows x 11 columns]" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import pandas as pd\n", + "url2 = \"https://raw.githubusercontent.com/data-bootcamp-v4/data/main/file2.csv\"\n", + "insurance_company_2_df = pd.read_csv(url2)\n", + "insurance_company_2_df" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "59e5a3e9-d2d1-4185-88b5-187d0316b5ba", + "metadata": { + "id": "492d06e3-92c7-4105-ac72-536db98d3244" + }, + "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", + "
CustomerStateCustomer Lifetime ValueEducationGenderIncomeMonthly Premium AutoNumber of Open ComplaintsPolicy TypeTotal Claim AmountVehicle Class
0SA25987Washington3479.137523High School or BelowM01040Personal Auto499.200000Two-Door Car
1TB86706Arizona2502.637401MasterM0660Personal Auto3.468912Two-Door Car
2ZL73902Nevada3265.156348BachelorF25820820Personal Auto393.600000Four-Door Car
3KX23516California4455.843406High School or BelowF01210Personal Auto699.615192SUV
4FN77294California7704.958480High School or BelowM303661012Personal Auto484.800000SUV
....................................
7065LA72316California23405.987980BachelorM71941730Personal Auto198.234764Four-Door Car
7066PK87824California3096.511217CollegeF21604790Corporate Auto379.200000Four-Door Car
7067TD14365California8163.890428BachelorM0853Corporate Auto790.784983Four-Door Car
7068UP19263California7524.442436CollegeM21941960Personal Auto691.200000Four-Door Car
7069Y167826California2611.836866CollegeM0770Corporate Auto369.600000Two-Door Car
\n", + "

7070 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " Customer State Customer Lifetime Value Education \\\n", + "0 SA25987 Washington 3479.137523 High School or Below \n", + "1 TB86706 Arizona 2502.637401 Master \n", + "2 ZL73902 Nevada 3265.156348 Bachelor \n", + "3 KX23516 California 4455.843406 High School or Below \n", + "4 FN77294 California 7704.958480 High School or Below \n", + "... ... ... ... ... \n", + "7065 LA72316 California 23405.987980 Bachelor \n", + "7066 PK87824 California 3096.511217 College \n", + "7067 TD14365 California 8163.890428 Bachelor \n", + "7068 UP19263 California 7524.442436 College \n", + "7069 Y167826 California 2611.836866 College \n", + "\n", + " Gender Income Monthly Premium Auto Number of Open Complaints \\\n", + "0 M 0 104 0 \n", + "1 M 0 66 0 \n", + "2 F 25820 82 0 \n", + "3 F 0 121 0 \n", + "4 M 30366 101 2 \n", + "... ... ... ... ... \n", + "7065 M 71941 73 0 \n", + "7066 F 21604 79 0 \n", + "7067 M 0 85 3 \n", + "7068 M 21941 96 0 \n", + "7069 M 0 77 0 \n", + "\n", + " Policy Type Total Claim Amount Vehicle Class \n", + "0 Personal Auto 499.200000 Two-Door Car \n", + "1 Personal Auto 3.468912 Two-Door Car \n", + "2 Personal Auto 393.600000 Four-Door Car \n", + "3 Personal Auto 699.615192 SUV \n", + "4 Personal Auto 484.800000 SUV \n", + "... ... ... ... \n", + "7065 Personal Auto 198.234764 Four-Door Car \n", + "7066 Corporate Auto 379.200000 Four-Door Car \n", + "7067 Corporate Auto 790.784983 Four-Door Car \n", + "7068 Personal Auto 691.200000 Four-Door Car \n", + "7069 Corporate Auto 369.600000 Two-Door Car \n", + "\n", + "[7070 rows x 11 columns]" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import pandas as pd\n", + "url3 = \"https://raw.githubusercontent.com/data-bootcamp-v4/data/main/file3.csv\"\n", + "insurance_company_3_df = pd.read_csv(url3)\n", + "insurance_company_3_df" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "965b2b85-2451-4677-8c43-847fbdd94383", + "metadata": {}, + "outputs": [], + "source": [ + "# first checking if the three tables have the same columns" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "1b181774-3d3e-4606-b762-9b541135db3c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['customer', 'state', 'gender', 'education', 'customer_lifetime_value',\n", + " 'income', 'monthly_premium_auto', 'number_of_open_complaints',\n", + " 'policy_type', 'vehicle_class', 'total_claim_amount'],\n", + " dtype='object')" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_company_1_df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "c6c4d881-c3ed-48b6-9316-105e12ca66b2", + "metadata": {}, + "outputs": [], + "source": [ + "# transforming the columns of tables 2 and 3 to the same format." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "8d0f2f22-5adf-40fc-9ea6-6b34b6ccb69d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['Customer', 'ST', 'GENDER', 'Education', 'Customer Lifetime Value',\n", + " 'Income', 'Monthly Premium Auto', 'Number of Open Complaints',\n", + " 'Total Claim Amount', 'Policy Type', 'Vehicle Class'],\n", + " dtype='object')" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_company_2_df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "08598b33-97d5-40a6-80aa-095b48f70737", + "metadata": {}, + "outputs": [], + "source": [ + "insurance_company_2_df.columns = insurance_company_2_df.columns.str.replace(\" \", \"_\", regex=False).str.strip().str.lower()" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "bec01013-b43d-477d-b2c3-9ed905638367", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['customer', 'state', 'gender', 'education', 'customer_lifetime_value',\n", + " 'income', 'monthly_premium_auto', 'number_of_open_complaints',\n", + " 'total_claim_amount', 'policy_type', 'vehicle_class'],\n", + " dtype='object')" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_company_2_df = insurance_company_2_df.rename(columns={\"st\": \"state\"})\n", + "insurance_company_2_df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "ab3d9806-d7c0-402d-b35e-b0e76e04014d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['Customer', 'State', 'Customer Lifetime Value', 'Education', 'Gender',\n", + " 'Income', 'Monthly Premium Auto', 'Number of Open Complaints',\n", + " 'Policy Type', 'Total Claim Amount', 'Vehicle Class'],\n", + " dtype='object')" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_company_3_df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "e419c7c1-f987-45f2-b714-101bfb066ea4", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['customer', 'state', 'customer_lifetime_value', 'education', 'gender',\n", + " 'income', 'monthly_premium_auto', 'number_of_open_complaints',\n", + " 'policy_type', 'total_claim_amount', 'vehicle_class'],\n", + " dtype='object')" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_company_3_df.columns = insurance_company_3_df.columns.str.replace(\" \", \"_\", regex=False).str.strip().str.lower()\n", + "insurance_company_3_df = insurance_company_3_df.rename(columns={\"st\": \"state\"})\n", + "insurance_company_3_df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "b6808a89-766d-489b-8941-6b6b3866e4a8", + "metadata": {}, + "outputs": [], + "source": [ + "# now checking if the contain the same columns" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "c50c19c5-1458-4f71-9c12-3565bd179712", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "set(insurance_company_1_df.columns) == set(insurance_company_2_df.columns) == set(insurance_company_3_df.columns)" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "232e44b6-78de-4e0a-8dde-f3f68be20b64", + "metadata": {}, + "outputs": [], + "source": [ + "# that means that we can use the same cleaning techniques we used for the first dataframe.\n", + "# we will concatenate tables 2 and 3, and then apply the cleaning." + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "2a1ce5fc-3cee-43a2-8f4c-824b18385efc", + "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_complaintstotal_claim_amountpolicy_typevehicle_class
0GS98873ArizonaFBachelor323912.47%16061881/0/00633.600000Personal AutoFour-Door Car
1CW49887CaliforniaFMaster462680.11%794871141/0/00547.200000Special AutoSUV
2MY31220CaliforniaFCollege899704.02%542301121/0/00537.600000Personal AutoTwo-Door Car
3UH35128OregonFCollege2580706.30%712102141/1/001027.200000Personal AutoLuxury Car
4WH52799ArizonaFCollege380812.21%94903941/0/00451.200000Corporate AutoTwo-Door Car
....................................
8061LA72316CaliforniaMBachelor23405.9879871941730198.234764Personal AutoFour-Door Car
8062PK87824CaliforniaFCollege3096.51121721604790379.200000Corporate AutoFour-Door Car
8063TD14365CaliforniaMBachelor8163.8904280853790.784983Corporate AutoFour-Door Car
8064UP19263CaliforniaMCollege7524.44243621941960691.200000Personal AutoFour-Door Car
8065Y167826CaliforniaMCollege2611.8368660770369.600000Corporate AutoTwo-Door Car
\n", + "

8066 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education customer_lifetime_value income \\\n", + "0 GS98873 Arizona F Bachelor 323912.47% 16061 \n", + "1 CW49887 California F Master 462680.11% 79487 \n", + "2 MY31220 California F College 899704.02% 54230 \n", + "3 UH35128 Oregon F College 2580706.30% 71210 \n", + "4 WH52799 Arizona F College 380812.21% 94903 \n", + "... ... ... ... ... ... ... \n", + "8061 LA72316 California M Bachelor 23405.98798 71941 \n", + "8062 PK87824 California F College 3096.511217 21604 \n", + "8063 TD14365 California M Bachelor 8163.890428 0 \n", + "8064 UP19263 California M College 7524.442436 21941 \n", + "8065 Y167826 California M College 2611.836866 0 \n", + "\n", + " monthly_premium_auto number_of_open_complaints total_claim_amount \\\n", + "0 88 1/0/00 633.600000 \n", + "1 114 1/0/00 547.200000 \n", + "2 112 1/0/00 537.600000 \n", + "3 214 1/1/00 1027.200000 \n", + "4 94 1/0/00 451.200000 \n", + "... ... ... ... \n", + "8061 73 0 198.234764 \n", + "8062 79 0 379.200000 \n", + "8063 85 3 790.784983 \n", + "8064 96 0 691.200000 \n", + "8065 77 0 369.600000 \n", + "\n", + " policy_type vehicle_class \n", + "0 Personal Auto Four-Door Car \n", + "1 Special Auto SUV \n", + "2 Personal Auto Two-Door Car \n", + "3 Personal Auto Luxury Car \n", + "4 Corporate Auto Two-Door Car \n", + "... ... ... \n", + "8061 Personal Auto Four-Door Car \n", + "8062 Corporate Auto Four-Door Car \n", + "8063 Corporate Auto Four-Door Car \n", + "8064 Personal Auto Four-Door Car \n", + "8065 Corporate Auto Two-Door Car \n", + "\n", + "[8066 rows x 11 columns]" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df = pd.concat([insurance_company_2_df, insurance_company_3_df], axis=0).reset_index(drop=True)\n", + "temporary_df" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "1e4b7ae6-0dce-490a-9089-a68bdb323802", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['F', 'M', nan, 'female', 'Male'], dtype=object)" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df[\"gender\"].unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "a3258ea2-fbc5-4bad-ba34-d7aa8e1aed93", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['F', 'M', nan], dtype=object)" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df[\"gender\"] = temporary_df[\"gender\"].map({\"F\" : \"F\", \"M\" : \"M\", \"Male\" : \"M\", \"female\" : \"F\", \"Femal\" : \"F\"})\n", + "temporary_df.gender.unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "7c85955e-637b-4ef9-a13e-184085cc95d0", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Arizona', 'California', 'Oregon', 'Nevada', 'Washington', 'AZ'],\n", + " dtype=object)" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df[\"state\"].unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "00510c9d-558a-47cb-a22f-95dee9328b67", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Arizona', 'California', 'Oregon', 'Nevada', 'Washington'],\n", + " dtype=object)" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df[\"state\"] = temporary_df[\"state\"].map({\"AZ\" : \"Arizona\", \"WA\" : \"Washington\", \"Cali\" : \"California\", \"Washington\" : \"Washington\", \"Arizona\" : \"Arizona\", \"Nevada\" : \"Nevada\", \"California\" : \"California\", \"Oregon\" : \"Oregon\"})\n", + "temporary_df.state.unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "4d123950-e499-4fa5-8232-6fa17138ed49", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Bachelor', 'Master', 'College', 'Doctor', 'Bachelors',\n", + " 'High School or Below'], dtype=object)" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df[\"education\"].unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "982010ba-9a5d-4d51-80a1-0fa0b51a38a2", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Bachelor', 'Master', 'College', 'Doctor', 'High School or Below'],\n", + " dtype=object)" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df[\"education\"] = temporary_df[\"education\"].map({\"Master\" : \"Master\", \"Bachelor\" : \"Bachelor\", \"Bachelors\" : \"Bachelor\", \"High School or Below\" : \"High School or Below\", \"College\" : \"College\", \"Doctor\" : \"Doctor\"})\n", + "temporary_df.education.unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "b3044811-0f48-42b1-9b78-b2372ff56d28", + "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_complaintstotal_claim_amountpolicy_typevehicle_class
0GS98873ArizonaFBachelor323912.4716061881/0/00633.600000Personal AutoFour-Door Car
1CW49887CaliforniaFMaster462680.11794871141/0/00547.200000Special AutoSUV
2MY31220CaliforniaFCollege899704.02542301121/0/00537.600000Personal AutoTwo-Door Car
3UH35128OregonFCollege2580706.30712102141/1/001027.200000Personal AutoLuxury Car
4WH52799ArizonaFCollege380812.2194903941/0/00451.200000Corporate AutoTwo-Door Car
....................................
8061LA72316CaliforniaMBachelor23405.9879871941730198.234764Personal AutoFour-Door Car
8062PK87824CaliforniaFCollege3096.51121721604790379.200000Corporate AutoFour-Door Car
8063TD14365CaliforniaMBachelor8163.8904280853790.784983Corporate AutoFour-Door Car
8064UP19263CaliforniaMCollege7524.44243621941960691.200000Personal AutoFour-Door Car
8065Y167826CaliforniaMCollege2611.8368660770369.600000Corporate AutoTwo-Door Car
\n", + "

8066 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education customer_lifetime_value income \\\n", + "0 GS98873 Arizona F Bachelor 323912.47 16061 \n", + "1 CW49887 California F Master 462680.11 79487 \n", + "2 MY31220 California F College 899704.02 54230 \n", + "3 UH35128 Oregon F College 2580706.30 71210 \n", + "4 WH52799 Arizona F College 380812.21 94903 \n", + "... ... ... ... ... ... ... \n", + "8061 LA72316 California M Bachelor 23405.98798 71941 \n", + "8062 PK87824 California F College 3096.511217 21604 \n", + "8063 TD14365 California M Bachelor 8163.890428 0 \n", + "8064 UP19263 California M College 7524.442436 21941 \n", + "8065 Y167826 California M College 2611.836866 0 \n", + "\n", + " monthly_premium_auto number_of_open_complaints total_claim_amount \\\n", + "0 88 1/0/00 633.600000 \n", + "1 114 1/0/00 547.200000 \n", + "2 112 1/0/00 537.600000 \n", + "3 214 1/1/00 1027.200000 \n", + "4 94 1/0/00 451.200000 \n", + "... ... ... ... \n", + "8061 73 0 198.234764 \n", + "8062 79 0 379.200000 \n", + "8063 85 3 790.784983 \n", + "8064 96 0 691.200000 \n", + "8065 77 0 369.600000 \n", + "\n", + " policy_type vehicle_class \n", + "0 Personal Auto Four-Door Car \n", + "1 Special Auto SUV \n", + "2 Personal Auto Two-Door Car \n", + "3 Personal Auto Luxury Car \n", + "4 Corporate Auto Two-Door Car \n", + "... ... ... \n", + "8061 Personal Auto Four-Door Car \n", + "8062 Corporate Auto Four-Door Car \n", + "8063 Corporate Auto Four-Door Car \n", + "8064 Personal Auto Four-Door Car \n", + "8065 Corporate Auto Two-Door Car \n", + "\n", + "[8066 rows x 11 columns]" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# In Customer Lifetime Value, delete the % character\n", + "\n", + "temporary_df[\"customer_lifetime_value\"] = temporary_df[\"customer_lifetime_value\"].astype(\"string\").str.strip(\"%\")\n", + "temporary_df" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "eca426f5-1225-4e97-b01b-10da601e576b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Four-Door Car', 'SUV', 'Two-Door Car', 'Luxury Car', 'Sports Car',\n", + " 'Luxury SUV'], dtype=object)" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# In vehicle class, \"Sports Car\", \"Luxury SUV\" and \"Luxury Car\" could be replaced by \"Luxury\"\n", + "temporary_df[\"vehicle_class\"].unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "5cfb7f3c-cc51-4968-a2cc-6a53d3cb0040", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Four-Door Car', 'SUV', 'Two-Door Car', 'Luxury'], dtype=object)" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df[\"vehicle_class\"] = temporary_df[\"vehicle_class\"].map({\"Four-Door Car\" : \"Four-Door Car\", \"Two-Door Car\" : \"Two-Door Car\", \"SUV\" : \"SUV\", \"Luxury SUV\" : \"Luxury\", \"Sports Car\" : \"Luxury\", \"Luxury Car\" : \"Luxury\"})\n", + "temporary_df[\"vehicle_class\"].unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "fc344b14-c41e-4c84-bfda-2098f5c8c5d1", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "customer object\n", + "state object\n", + "gender string[python]\n", + "education string[python]\n", + "customer_lifetime_value Float64\n", + "income int64\n", + "monthly_premium_auto int64\n", + "number_of_open_complaints Int64\n", + "total_claim_amount float64\n", + "policy_type string[python]\n", + "vehicle_class string[python]\n", + "dtype: object" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# formatting data types to concatenate with the clean table:\n", + "temporary_df[\"gender\"] = temporary_df[\"gender\"].astype(\"string\")\n", + "temporary_df[\"education\"] = temporary_df[\"education\"].astype(\"string\")\n", + "temporary_df[\"policy_type\"] = temporary_df[\"policy_type\"].astype(\"string\")\n", + "temporary_df[\"vehicle_class\"] = temporary_df[\"vehicle_class\"].astype(\"string\")\n", + "temporary_df[\"customer_lifetime_value\"] = temporary_df[\"customer_lifetime_value\"].astype(\"Float64\")\n", + "temporary_df[\"number_of_open_complaints\"] = temporary_df[\"number_of_open_complaints\"].astype(\"string\")\n", + "temporary_df[\"number_of_open_complaints\"] = temporary_df[\"number_of_open_complaints\"].str.split(\"/\").str[1]\n", + "temporary_df[\"number_of_open_complaints\"] = temporary_df[\"number_of_open_complaints\"].astype(\"Int64\")\n", + "temporary_df.dtypes" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "c50d0f38-0523-4c03-896c-f5606b65cc67", + "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_complaintstotal_claim_amountpolicy_typevehicle_class
0GS98873ArizonaFBachelor323912.4716061880633.600000Personal AutoFour-Door Car
1CW49887CaliforniaFMaster462680.11794871140547.200000Special AutoSUV
2MY31220CaliforniaFCollege899704.02542301120537.600000Personal AutoTwo-Door Car
3UH35128OregonFCollege2580706.37121021411027.200000Personal AutoLuxury
4WH52799ArizonaFCollege380812.2194903940451.200000Corporate AutoTwo-Door Car
....................................
8061LA72316CaliforniaMBachelor23405.987987194173<NA>198.234764Personal AutoFour-Door Car
8062PK87824CaliforniaFCollege3096.5112172160479<NA>379.200000Corporate AutoFour-Door Car
8063TD14365CaliforniaMBachelor8163.890428085<NA>790.784983Corporate AutoFour-Door Car
8064UP19263CaliforniaMCollege7524.4424362194196<NA>691.200000Personal AutoFour-Door Car
8065Y167826CaliforniaMCollege2611.836866077<NA>369.600000Corporate AutoTwo-Door Car
\n", + "

8066 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education customer_lifetime_value income \\\n", + "0 GS98873 Arizona F Bachelor 323912.47 16061 \n", + "1 CW49887 California F Master 462680.11 79487 \n", + "2 MY31220 California F College 899704.02 54230 \n", + "3 UH35128 Oregon F College 2580706.3 71210 \n", + "4 WH52799 Arizona F College 380812.21 94903 \n", + "... ... ... ... ... ... ... \n", + "8061 LA72316 California M Bachelor 23405.98798 71941 \n", + "8062 PK87824 California F College 3096.511217 21604 \n", + "8063 TD14365 California M Bachelor 8163.890428 0 \n", + "8064 UP19263 California M College 7524.442436 21941 \n", + "8065 Y167826 California M College 2611.836866 0 \n", + "\n", + " monthly_premium_auto number_of_open_complaints total_claim_amount \\\n", + "0 88 0 633.600000 \n", + "1 114 0 547.200000 \n", + "2 112 0 537.600000 \n", + "3 214 1 1027.200000 \n", + "4 94 0 451.200000 \n", + "... ... ... ... \n", + "8061 73 198.234764 \n", + "8062 79 379.200000 \n", + "8063 85 790.784983 \n", + "8064 96 691.200000 \n", + "8065 77 369.600000 \n", + "\n", + " policy_type vehicle_class \n", + "0 Personal Auto Four-Door Car \n", + "1 Special Auto SUV \n", + "2 Personal Auto Two-Door Car \n", + "3 Personal Auto Luxury \n", + "4 Corporate Auto Two-Door Car \n", + "... ... ... \n", + "8061 Personal Auto Four-Door Car \n", + "8062 Corporate Auto Four-Door Car \n", + "8063 Corporate Auto Four-Door Car \n", + "8064 Personal Auto Four-Door Car \n", + "8065 Corporate Auto Two-Door Car \n", + "\n", + "[8066 rows x 11 columns]" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "d573b6bb-38d3-4e32-a386-533d3d8daa9e", + "metadata": {}, + "outputs": [], + "source": [ + "# dropping null values" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "fdb8c864-b7b1-4493-97f1-6940d96637b2", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "customer 0\n", + "state 0\n", + "gender 5\n", + "education 0\n", + "customer_lifetime_value 4\n", + "income 0\n", + "monthly_premium_auto 0\n", + "number_of_open_complaints 7070\n", + "total_claim_amount 0\n", + "policy_type 0\n", + "vehicle_class 0\n", + "dtype: int64" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df.isnull().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "f0e7efcd-e82e-4872-88f4-8e816877198a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "customer 0\n", + "state 0\n", + "gender 0\n", + "education 0\n", + "customer_lifetime_value 0\n", + "income 0\n", + "monthly_premium_auto 0\n", + "number_of_open_complaints 7070\n", + "total_claim_amount 0\n", + "policy_type 0\n", + "vehicle_class 0\n", + "dtype: int64" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# filling NaN gender with \"Unknown\"\n", + "temporary_df[\"gender\"] = temporary_df[\"gender\"].fillna(\"Unknown\")\n", + "# customre lifetime value with the median of temporary_df (we could do it as well with the median of all 3 tables for more accurate results, but since the temporary tables has more than 8000 rows, and only 4 values are missing, we consifer this median accurate enough.\n", + "median__temp_clv = temporary_df[\"customer_lifetime_value\"].median()\n", + "temporary_df[\"customer_lifetime_value\"] = (temporary_df[\"customer_lifetime_value\"].fillna(median__temp_clv))\n", + "temporary_df.isnull().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "df1597b6-04ea-4d70-8f27-9dc7db79fd4f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "customer 0\n", + "state 0\n", + "gender 0\n", + "education 0\n", + "customer_lifetime_value 0\n", + "income 0\n", + "monthly_premium_auto 0\n", + "number_of_open_complaints 0\n", + "total_claim_amount 0\n", + "policy_type 0\n", + "vehicle_class 0\n", + "dtype: int64" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# we consider most likely, that the reason that for 7070 customer IDs we have NaN values at open complaints, is because the actual value of them is 0.\n", + "temporary_df[\"number_of_open_complaints\"] = (temporary_df[\"number_of_open_complaints\"].fillna(0))\n", + "temporary_df.isnull().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "id": "c85c18f2-6310-46f3-9af7-1f25a54885ae", + "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
0RB50392WashingtonUnknownMaster588174.2350.01000.00Personal AutoFour-Door Car2.704934
1QZ44356ArizonaFBachelor697953.590.094.00Personal AutoFour-Door Car1131.464935
2AI49188NevadaFBachelor1288743.1748767.0108.00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniaMBachelor764586.180.0106.00Corporate AutoSUV529.881344
4GA49547WashingtonMHigh School or Below536307.6536357.068.00Personal AutoFour-Door Car17.269323
....................................
9132LA72316CaliforniaMBachelor23405.9879871941.073.00Personal AutoFour-Door Car198.234764
9133PK87824CaliforniaFCollege3096.51121721604.079.00Corporate AutoFour-Door Car379.200000
9134TD14365CaliforniaMBachelor8163.8904280.085.00Corporate AutoFour-Door Car790.784983
9135UP19263CaliforniaMCollege7524.44243621941.096.00Personal AutoFour-Door Car691.200000
9136Y167826CaliforniaMCollege2611.8368660.077.00Corporate AutoTwo-Door Car369.600000
\n", + "

9137 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education \\\n", + "0 RB50392 Washington Unknown 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", + "9132 LA72316 California M Bachelor \n", + "9133 PK87824 California F College \n", + "9134 TD14365 California M Bachelor \n", + "9135 UP19263 California M College \n", + "9136 Y167826 California M College \n", + "\n", + " customer_lifetime_value income monthly_premium_auto \\\n", + "0 588174.235 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", + "9132 23405.98798 71941.0 73.0 \n", + "9133 3096.511217 21604.0 79.0 \n", + "9134 8163.890428 0.0 85.0 \n", + "9135 7524.442436 21941.0 96.0 \n", + "9136 2611.836866 0.0 77.0 \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", + "9132 0 Personal Auto Four-Door Car \n", + "9133 0 Corporate Auto Four-Door Car \n", + "9134 0 Corporate Auto Four-Door Car \n", + "9135 0 Personal Auto Four-Door Car \n", + "9136 0 Corporate Auto Two-Door Car \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", + "9132 198.234764 \n", + "9133 379.200000 \n", + "9134 790.784983 \n", + "9135 691.200000 \n", + "9136 369.600000 \n", + "\n", + "[9137 rows x 11 columns]" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# and now we concatenate\n", + "insurance_updated_df = pd.concat([insurance_company_1_df, temporary_df], axis=0).reset_index(drop=True)\n", + "insurance_updated_df" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "46aab717-2337-400d-9204-3f70a67c5eed", + "metadata": {}, + "outputs": [], + "source": [ + "# The rows and columns total indicate that everything has been merged coorectly." + ] + }, + { + "cell_type": "markdown", + "id": "31b8a9e7-7db9-4604-991b-ef6771603e57", + "metadata": { + "id": "31b8a9e7-7db9-4604-991b-ef6771603e57" + }, + "source": [ + "# Challenge 2: Structuring Data" + ] + }, + { + "cell_type": "markdown", + "id": "a877fd6d-7a0c-46d2-9657-f25036e4ca4b", + "metadata": { + "id": "a877fd6d-7a0c-46d2-9657-f25036e4ca4b" + }, + "source": [ + "In this challenge, we will continue to work with customer data from an insurance company, but we will use a dataset with more columns, called marketing_customer_analysis.csv, which can be found at the following link:\n", + "\n", + "https://raw.githubusercontent.com/data-bootcamp-v4/data/main/marketing_customer_analysis_clean.csv\n", + "\n", + "This dataset contains information such as customer demographics, policy details, vehicle information, and the customer's response to the last marketing campaign. Our goal is to explore and analyze this data by performing data cleaning, formatting, and structuring." + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "aa10d9b0-1c27-4d3f-a8e4-db6ab73bfd26", + "metadata": { + "id": "aa10d9b0-1c27-4d3f-a8e4-db6ab73bfd26" + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
unnamed:_0customerstatecustomer_lifetime_valueresponsecoverageeducationeffective_to_dateemploymentstatusgender...number_of_policiespolicy_typepolicyrenew_offer_typesales_channeltotal_claim_amountvehicle_classvehicle_sizevehicle_typemonth
00DK49336Arizona4809.216960NoBasicCollege2011-02-18EmployedM...9Corporate AutoCorporate L3Offer3Agent292.800000Four-Door CarMedsizeA2
11KX64629California2228.525238NoBasicCollege2011-01-18UnemployedF...1Personal AutoPersonal L3Offer4Call Center744.924331Four-Door CarMedsizeA1
22LZ68649Washington14947.917300NoBasicBachelor2011-02-10EmployedM...2Personal AutoPersonal L3Offer3Call Center480.000000SUVMedsizeA2
33XL78013Oregon22332.439460YesExtendedCollege2011-01-11EmployedM...2Corporate AutoCorporate L3Offer2Branch484.013411Four-Door CarMedsizeA1
44QA50777Oregon9025.067525NoPremiumBachelor2011-01-17Medical LeaveF...7Personal AutoPersonal L2Offer1Branch707.925645Four-Door CarMedsizeA1
..................................................................
1090510905FE99816Nevada15563.369440NoPremiumBachelor2011-01-19UnemployedF...7Personal AutoPersonal L1Offer3Web1214.400000Luxury CarMedsizeA1
1090610906KX53892Oregon5259.444853NoBasicCollege2011-01-06EmployedF...6Personal AutoPersonal L3Offer2Branch273.018929Four-Door CarMedsizeA1
1090710907TL39050Arizona23893.304100NoExtendedBachelor2011-02-06EmployedF...2Corporate AutoCorporate L3Offer1Web381.306996Luxury SUVMedsizeA2
1090810908WA60547California11971.977650NoPremiumCollege2011-02-13EmployedF...6Personal AutoPersonal L1Offer1Branch618.288849SUVMedsizeA2
1090910909IV32877California6857.519928NoBasicBachelor2011-01-08UnemployedM...3Personal AutoPersonal L1Offer4Web1021.719397SUVMedsizeA1
\n", + "

10910 rows × 27 columns

\n", + "
" + ], + "text/plain": [ + " unnamed:_0 customer state customer_lifetime_value response \\\n", + "0 0 DK49336 Arizona 4809.216960 No \n", + "1 1 KX64629 California 2228.525238 No \n", + "2 2 LZ68649 Washington 14947.917300 No \n", + "3 3 XL78013 Oregon 22332.439460 Yes \n", + "4 4 QA50777 Oregon 9025.067525 No \n", + "... ... ... ... ... ... \n", + "10905 10905 FE99816 Nevada 15563.369440 No \n", + "10906 10906 KX53892 Oregon 5259.444853 No \n", + "10907 10907 TL39050 Arizona 23893.304100 No \n", + "10908 10908 WA60547 California 11971.977650 No \n", + "10909 10909 IV32877 California 6857.519928 No \n", + "\n", + " coverage education effective_to_date employmentstatus gender ... \\\n", + "0 Basic College 2011-02-18 Employed M ... \n", + "1 Basic College 2011-01-18 Unemployed F ... \n", + "2 Basic Bachelor 2011-02-10 Employed M ... \n", + "3 Extended College 2011-01-11 Employed M ... \n", + "4 Premium Bachelor 2011-01-17 Medical Leave F ... \n", + "... ... ... ... ... ... ... \n", + "10905 Premium Bachelor 2011-01-19 Unemployed F ... \n", + "10906 Basic College 2011-01-06 Employed F ... \n", + "10907 Extended Bachelor 2011-02-06 Employed F ... \n", + "10908 Premium College 2011-02-13 Employed F ... \n", + "10909 Basic Bachelor 2011-01-08 Unemployed M ... \n", + "\n", + " number_of_policies policy_type policy renew_offer_type \\\n", + "0 9 Corporate Auto Corporate L3 Offer3 \n", + "1 1 Personal Auto Personal L3 Offer4 \n", + "2 2 Personal Auto Personal L3 Offer3 \n", + "3 2 Corporate Auto Corporate L3 Offer2 \n", + "4 7 Personal Auto Personal L2 Offer1 \n", + "... ... ... ... ... \n", + "10905 7 Personal Auto Personal L1 Offer3 \n", + "10906 6 Personal Auto Personal L3 Offer2 \n", + "10907 2 Corporate Auto Corporate L3 Offer1 \n", + "10908 6 Personal Auto Personal L1 Offer1 \n", + "10909 3 Personal Auto Personal L1 Offer4 \n", + "\n", + " sales_channel total_claim_amount vehicle_class vehicle_size \\\n", + "0 Agent 292.800000 Four-Door Car Medsize \n", + "1 Call Center 744.924331 Four-Door Car Medsize \n", + "2 Call Center 480.000000 SUV Medsize \n", + "3 Branch 484.013411 Four-Door Car Medsize \n", + "4 Branch 707.925645 Four-Door Car Medsize \n", + "... ... ... ... ... \n", + "10905 Web 1214.400000 Luxury Car Medsize \n", + "10906 Branch 273.018929 Four-Door Car Medsize \n", + "10907 Web 381.306996 Luxury SUV Medsize \n", + "10908 Branch 618.288849 SUV Medsize \n", + "10909 Web 1021.719397 SUV Medsize \n", + "\n", + " vehicle_type month \n", + "0 A 2 \n", + "1 A 1 \n", + "2 A 2 \n", + "3 A 1 \n", + "4 A 1 \n", + "... ... ... \n", + "10905 A 1 \n", + "10906 A 1 \n", + "10907 A 2 \n", + "10908 A 2 \n", + "10909 A 1 \n", + "\n", + "[10910 rows x 27 columns]" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import pandas as pd\n", + "url_marketing = \"https://raw.githubusercontent.com/data-bootcamp-v4/data/main/marketing_customer_analysis_clean.csv\"\n", + "insurance_and_marketing_df = pd.read_csv(url_marketing)\n", + "insurance_and_marketing_df" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "id": "f251c23d-260f-432d-8367-d8848ddc88bc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['unnamed:_0', 'customer', 'state', 'customer_lifetime_value',\n", + " 'response', 'coverage', 'education', 'effective_to_date',\n", + " 'employmentstatus', 'gender', 'income', 'location_code',\n", + " 'marital_status', 'monthly_premium_auto', 'months_since_last_claim',\n", + " 'months_since_policy_inception', 'number_of_open_complaints',\n", + " 'number_of_policies', 'policy_type', 'policy', 'renew_offer_type',\n", + " 'sales_channel', 'total_claim_amount', 'vehicle_class', 'vehicle_size',\n", + " 'vehicle_type', 'month'],\n", + " dtype='object')" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_and_marketing_df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "id": "a608552b-48cc-4fe5-ac82-1d53e96038a6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['customer', 'state', 'customer_lifetime_value', 'response', 'coverage',\n", + " 'education', 'effective_to_date', 'employmentstatus', 'gender',\n", + " 'income', 'location_code', 'marital_status', 'monthly_premium_auto',\n", + " 'months_since_last_claim', 'months_since_policy_inception',\n", + " 'number_of_open_complaints', 'number_of_policies', 'policy_type',\n", + " 'policy', 'renew_offer_type', 'sales_channel', 'total_claim_amount',\n", + " 'vehicle_class', 'vehicle_size', 'vehicle_type', 'month'],\n", + " dtype='object')" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_and_marketing_df = insurance_and_marketing_df.drop(columns=[\"unnamed:_0\"])\n", + "insurance_and_marketing_df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "id": "362f9436-504b-4a71-bf92-3570351acfc8", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['customer', 'state', 'customer_lifetime_value', 'response', 'coverage',\n", + " 'education', 'effective_to_date', 'employmentstatus', 'gender',\n", + " 'income', 'location_code', 'marital_status', 'monthly_premium_auto',\n", + " 'months_since_last_claim', 'months_since_policy_inception',\n", + " 'number_of_open_complaints', 'number_of_policies', 'policy_type',\n", + " 'policy', 'renew_offer_type', 'sales_channel', 'total_claim_amount',\n", + " 'vehicle_class', 'vehicle_size', 'vehicle_type', 'month'],\n", + " dtype='object')" + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_and_marketing_df.columns = insurance_and_marketing_df.columns.str.replace(\" \", \"_\", regex=False).str.strip().str.lower()\n", + "insurance_and_marketing_df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "id": "ec16b75d-58ae-46b1-977c-3c763f63d7d4", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "customer 0\n", + "state 0\n", + "customer_lifetime_value 0\n", + "response 0\n", + "coverage 0\n", + "education 0\n", + "effective_to_date 0\n", + "employmentstatus 0\n", + "gender 0\n", + "income 0\n", + "location_code 0\n", + "marital_status 0\n", + "monthly_premium_auto 0\n", + "months_since_last_claim 0\n", + "months_since_policy_inception 0\n", + "number_of_open_complaints 0\n", + "number_of_policies 0\n", + "policy_type 0\n", + "policy 0\n", + "renew_offer_type 0\n", + "sales_channel 0\n", + "total_claim_amount 0\n", + "vehicle_class 0\n", + "vehicle_size 0\n", + "vehicle_type 0\n", + "month 0\n", + "dtype: int64" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# now that we cleaned and formatted the columns, let's check for null values and duplicates.\n", + "insurance_and_marketing_df.isnull().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "id": "57fd70a7-8cdc-4b97-8159-9aa878612d56", + "metadata": {}, + "outputs": [], + "source": [ + "# that's fantastic, Marketing does an excellent job in reporting data. \n", + "# But before we give them a golden star, let's see if there are duplicates." + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "id": "28282a37-98d7-42f7-8dba-aa0a01f5a2a2", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "np.int64(443)" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_and_marketing_df.duplicated().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "0d89a895-f81c-4f2d-99c9-92a7e7b3e57f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "np.int64(1776)" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Check for duplicates in columns where duplicates could create an issue, like customer, the rest can have duplicates.\n", + "insurance_and_marketing_df.duplicated(subset=['customer']).sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "id": "c89b1227-bbb6-4f7d-ac4d-de25500a74fc", + "metadata": {}, + "outputs": [], + "source": [ + "# if rows had empty values based on the check above, it would be essential to check which duplicates to drop, keeping those with the most values. \n", + "# since no rows have NaN values, then we can simply perform a basic duplicates drop." + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "id": "aa15b55e-2b14-430a-a0f1-f82d1491ca3d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "np.int64(0)" + ] + }, + "execution_count": 48, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# now let's drop them\n", + "insurance_and_marketing_df = insurance_and_marketing_df.drop_duplicates(subset=['customer'])\n", + "insurance_and_marketing_df.duplicated().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "507f62a2-b5c1-40cc-aabf-ecc3a61e62a6", + "metadata": {}, + "outputs": [], + "source": [ + "# the above means that all duplicated were 443, all in the customer column, and were repeated more than 4 times. After deleting the duplications, we end up with the 443 unique rows from those customers." + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "id": "34ecbf46-48b6-427c-a015-90fc224cc862", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
customerstatecustomer_lifetime_valueresponsecoverageeducationeffective_to_dateemploymentstatusgenderincome...number_of_policiespolicy_typepolicyrenew_offer_typesales_channeltotal_claim_amountvehicle_classvehicle_sizevehicle_typemonth
0DK49336Arizona4809.216960NoBasicCollege2011-02-18EmployedM48029...9Corporate AutoCorporate L3Offer3Agent292.800000Four-Door CarMedsizeA2
1KX64629California2228.525238NoBasicCollege2011-01-18UnemployedF0...1Personal AutoPersonal L3Offer4Call Center744.924331Four-Door CarMedsizeA1
2LZ68649Washington14947.917300NoBasicBachelor2011-02-10EmployedM22139...2Personal AutoPersonal L3Offer3Call Center480.000000SUVMedsizeA2
3XL78013Oregon22332.439460YesExtendedCollege2011-01-11EmployedM49078...2Corporate AutoCorporate L3Offer2Branch484.013411Four-Door CarMedsizeA1
4QA50777Oregon9025.067525NoPremiumBachelor2011-01-17Medical LeaveF23675...7Personal AutoPersonal L2Offer1Branch707.925645Four-Door CarMedsizeA1
..................................................................
10903SU71163Arizona2771.663013NoBasicCollege2011-01-07EmployedM59855...1Personal AutoPersonal L2Offer2Branch355.200000Two-Door CarMedsizeA1
10904QI63521Nevada19228.463620NoBasicHigh School or Below2011-02-24UnemployedM0...2Personal AutoPersonal L2Offer1Branch897.600000Luxury SUVMedsizeA2
10906KX53892Oregon5259.444853NoBasicCollege2011-01-06EmployedF61146...6Personal AutoPersonal L3Offer2Branch273.018929Four-Door CarMedsizeA1
10907TL39050Arizona23893.304100NoExtendedBachelor2011-02-06EmployedF39837...2Corporate AutoCorporate L3Offer1Web381.306996Luxury SUVMedsizeA2
10908WA60547California11971.977650NoPremiumCollege2011-02-13EmployedF64195...6Personal AutoPersonal L1Offer1Branch618.288849SUVMedsizeA2
\n", + "

9134 rows × 26 columns

\n", + "
" + ], + "text/plain": [ + " customer state customer_lifetime_value response coverage \\\n", + "0 DK49336 Arizona 4809.216960 No Basic \n", + "1 KX64629 California 2228.525238 No Basic \n", + "2 LZ68649 Washington 14947.917300 No Basic \n", + "3 XL78013 Oregon 22332.439460 Yes Extended \n", + "4 QA50777 Oregon 9025.067525 No Premium \n", + "... ... ... ... ... ... \n", + "10903 SU71163 Arizona 2771.663013 No Basic \n", + "10904 QI63521 Nevada 19228.463620 No Basic \n", + "10906 KX53892 Oregon 5259.444853 No Basic \n", + "10907 TL39050 Arizona 23893.304100 No Extended \n", + "10908 WA60547 California 11971.977650 No Premium \n", + "\n", + " education effective_to_date employmentstatus gender income \\\n", + "0 College 2011-02-18 Employed M 48029 \n", + "1 College 2011-01-18 Unemployed F 0 \n", + "2 Bachelor 2011-02-10 Employed M 22139 \n", + "3 College 2011-01-11 Employed M 49078 \n", + "4 Bachelor 2011-01-17 Medical Leave F 23675 \n", + "... ... ... ... ... ... \n", + "10903 College 2011-01-07 Employed M 59855 \n", + "10904 High School or Below 2011-02-24 Unemployed M 0 \n", + "10906 College 2011-01-06 Employed F 61146 \n", + "10907 Bachelor 2011-02-06 Employed F 39837 \n", + "10908 College 2011-02-13 Employed F 64195 \n", + "\n", + " ... number_of_policies policy_type policy renew_offer_type \\\n", + "0 ... 9 Corporate Auto Corporate L3 Offer3 \n", + "1 ... 1 Personal Auto Personal L3 Offer4 \n", + "2 ... 2 Personal Auto Personal L3 Offer3 \n", + "3 ... 2 Corporate Auto Corporate L3 Offer2 \n", + "4 ... 7 Personal Auto Personal L2 Offer1 \n", + "... ... ... ... ... ... \n", + "10903 ... 1 Personal Auto Personal L2 Offer2 \n", + "10904 ... 2 Personal Auto Personal L2 Offer1 \n", + "10906 ... 6 Personal Auto Personal L3 Offer2 \n", + "10907 ... 2 Corporate Auto Corporate L3 Offer1 \n", + "10908 ... 6 Personal Auto Personal L1 Offer1 \n", + "\n", + " sales_channel total_claim_amount vehicle_class vehicle_size \\\n", + "0 Agent 292.800000 Four-Door Car Medsize \n", + "1 Call Center 744.924331 Four-Door Car Medsize \n", + "2 Call Center 480.000000 SUV Medsize \n", + "3 Branch 484.013411 Four-Door Car Medsize \n", + "4 Branch 707.925645 Four-Door Car Medsize \n", + "... ... ... ... ... \n", + "10903 Branch 355.200000 Two-Door Car Medsize \n", + "10904 Branch 897.600000 Luxury SUV Medsize \n", + "10906 Branch 273.018929 Four-Door Car Medsize \n", + "10907 Web 381.306996 Luxury SUV Medsize \n", + "10908 Branch 618.288849 SUV Medsize \n", + "\n", + " vehicle_type month \n", + "0 A 2 \n", + "1 A 1 \n", + "2 A 2 \n", + "3 A 1 \n", + "4 A 1 \n", + "... ... ... \n", + "10903 A 1 \n", + "10904 A 2 \n", + "10906 A 1 \n", + "10907 A 2 \n", + "10908 A 2 \n", + "\n", + "[9134 rows x 26 columns]" + ] + }, + "execution_count": 49, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_and_marketing_df" + ] + }, + { + "cell_type": "markdown", + "id": "df35fd0d-513e-4e77-867e-429da10a9cc7", + "metadata": { + "id": "df35fd0d-513e-4e77-867e-429da10a9cc7" + }, + "source": [ + "1. You work at the marketing department and you want to know which sales channel brought the most sales in terms of total revenue. Using pivot, create a summary table showing the total revenue for each sales channel (branch, call center, web, and mail).\n", + "Round the total revenue to 2 decimal points. Analyze the resulting table to draw insights." + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "id": "a2fc75f9-d5ad-45c9-bd3c-8709b593c23e", + "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", + "
customerstatecustomer_lifetime_valueresponsecoverageeducationeffective_to_dateemploymentstatusgenderincome...policy_typepolicyrenew_offer_typesales_channeltotal_claim_amountvehicle_classvehicle_sizevehicle_typemonthmonthly_premium_auto_y
0DK49336Arizona4809.216960NoBasicCollege2011-02-18EmployedM48029...Corporate AutoCorporate L3Offer3Agent292.800000Four-Door CarMedsizeA261.0
1KX64629California2228.525238NoBasicCollege2011-01-18UnemployedF0...Personal AutoPersonal L3Offer4Call Center744.924331Four-Door CarMedsizeA164.0
2LZ68649Washington14947.917300NoBasicBachelor2011-02-10EmployedM22139...Personal AutoPersonal L3Offer3Call Center480.000000SUVMedsizeA2100.0
3XL78013Oregon22332.439460YesExtendedCollege2011-01-11EmployedM49078...Corporate AutoCorporate L3Offer2Branch484.013411Four-Door CarMedsizeA197.0
4QA50777Oregon9025.067525NoPremiumBachelor2011-01-17Medical LeaveF23675...Personal AutoPersonal L2Offer1Branch707.925645Four-Door CarMedsizeA1117.0
\n", + "

5 rows × 27 columns

\n", + "
" + ], + "text/plain": [ + " customer state customer_lifetime_value response coverage education \\\n", + "0 DK49336 Arizona 4809.216960 No Basic College \n", + "1 KX64629 California 2228.525238 No Basic College \n", + "2 LZ68649 Washington 14947.917300 No Basic Bachelor \n", + "3 XL78013 Oregon 22332.439460 Yes Extended College \n", + "4 QA50777 Oregon 9025.067525 No Premium Bachelor \n", + "\n", + " effective_to_date employmentstatus gender income ... policy_type \\\n", + "0 2011-02-18 Employed M 48029 ... Corporate Auto \n", + "1 2011-01-18 Unemployed F 0 ... Personal Auto \n", + "2 2011-02-10 Employed M 22139 ... Personal Auto \n", + "3 2011-01-11 Employed M 49078 ... Corporate Auto \n", + "4 2011-01-17 Medical Leave F 23675 ... Personal Auto \n", + "\n", + " policy renew_offer_type sales_channel total_claim_amount \\\n", + "0 Corporate L3 Offer3 Agent 292.800000 \n", + "1 Personal L3 Offer4 Call Center 744.924331 \n", + "2 Personal L3 Offer3 Call Center 480.000000 \n", + "3 Corporate L3 Offer2 Branch 484.013411 \n", + "4 Personal L2 Offer1 Branch 707.925645 \n", + "\n", + " vehicle_class vehicle_size vehicle_type month monthly_premium_auto_y \n", + "0 Four-Door Car Medsize A 2 61.0 \n", + "1 Four-Door Car Medsize A 1 64.0 \n", + "2 SUV Medsize A 2 100.0 \n", + "3 Four-Door Car Medsize A 1 97.0 \n", + "4 Four-Door Car Medsize A 1 117.0 \n", + "\n", + "[5 rows x 27 columns]" + ] + }, + "execution_count": 51, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# first let's create a column for the reveue per customer.\n", + "# to calculate the total revenue per customer, I need to bring the monthly_premium_auto information from the 'insurance_updated_df'.\n", + "# we will do an inner merge, to discard the extra 3 rows that the marketing table has compared to the insurance one.\n", + "\n", + "merged_df = insurance_and_marketing_df.merge(\n", + " insurance_updated_df[[\"customer\", \"monthly_premium_auto\"]],\n", + " on=\"customer\",\n", + " how=\"inner\"\n", + ")\n", + "merged_df.head(5)" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "id": "46a1fc9d-7a17-4327-951a-d9fb38359322", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(9137, 27)" + ] + }, + "execution_count": 52, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "merged_df.shape" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "id": "1a8875c9-1d14-4f53-8e25-14f6c41104b6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "np.int64(0)" + ] + }, + "execution_count": 53, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "merged_df[\"customer\"].isnull().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "id": "30690cb1-2e0b-4670-a789-db181a1e0dd8", + "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", + "
customerstatecustomer_lifetime_valueresponsecoverageeducationeffective_to_dateemploymentstatusgenderincome...policyrenew_offer_typesales_channeltotal_claim_amountvehicle_classvehicle_sizevehicle_typemonthmonthly_premium_auto_yrevenue
0DK49336Arizona4809.216960NoBasicCollege2011-02-18EmployedM48029...Corporate L3Offer3Agent292.800000Four-Door CarMedsizeA261.0122.0
1KX64629California2228.525238NoBasicCollege2011-01-18UnemployedF0...Personal L3Offer4Call Center744.924331Four-Door CarMedsizeA164.064.0
2LZ68649Washington14947.917300NoBasicBachelor2011-02-10EmployedM22139...Personal L3Offer3Call Center480.000000SUVMedsizeA2100.0200.0
3XL78013Oregon22332.439460YesExtendedCollege2011-01-11EmployedM49078...Corporate L3Offer2Branch484.013411Four-Door CarMedsizeA197.097.0
4QA50777Oregon9025.067525NoPremiumBachelor2011-01-17Medical LeaveF23675...Personal L2Offer1Branch707.925645Four-Door CarMedsizeA1117.0117.0
\n", + "

5 rows × 28 columns

\n", + "
" + ], + "text/plain": [ + " customer state customer_lifetime_value response coverage education \\\n", + "0 DK49336 Arizona 4809.216960 No Basic College \n", + "1 KX64629 California 2228.525238 No Basic College \n", + "2 LZ68649 Washington 14947.917300 No Basic Bachelor \n", + "3 XL78013 Oregon 22332.439460 Yes Extended College \n", + "4 QA50777 Oregon 9025.067525 No Premium Bachelor \n", + "\n", + " effective_to_date employmentstatus gender income ... policy \\\n", + "0 2011-02-18 Employed M 48029 ... Corporate L3 \n", + "1 2011-01-18 Unemployed F 0 ... Personal L3 \n", + "2 2011-02-10 Employed M 22139 ... Personal L3 \n", + "3 2011-01-11 Employed M 49078 ... Corporate L3 \n", + "4 2011-01-17 Medical Leave F 23675 ... Personal L2 \n", + "\n", + " renew_offer_type sales_channel total_claim_amount vehicle_class \\\n", + "0 Offer3 Agent 292.800000 Four-Door Car \n", + "1 Offer4 Call Center 744.924331 Four-Door Car \n", + "2 Offer3 Call Center 480.000000 SUV \n", + "3 Offer2 Branch 484.013411 Four-Door Car \n", + "4 Offer1 Branch 707.925645 Four-Door Car \n", + "\n", + " vehicle_size vehicle_type month monthly_premium_auto_y revenue \n", + "0 Medsize A 2 61.0 122.0 \n", + "1 Medsize A 1 64.0 64.0 \n", + "2 Medsize A 2 100.0 200.0 \n", + "3 Medsize A 1 97.0 97.0 \n", + "4 Medsize A 1 117.0 117.0 \n", + "\n", + "[5 rows x 28 columns]" + ] + }, + "execution_count": 55, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Now let's create the pivot table\n", + "# first we need to create a column for the revenue:\n", + "merged_df[\"revenue\"] = merged_df[\"monthly_premium_auto_y\"]*merged_df[\"month\"]\n", + "merged_df.head(5)" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "id": "88cccac9-b099-4e13-90f9-3868644e0383", + "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", + "
revenue
sales_channel
Agent644583.0
Branch405342.0
Call Center259203.0
Web191681.0
\n", + "
" + ], + "text/plain": [ + " revenue\n", + "sales_channel \n", + "Agent 644583.0\n", + "Branch 405342.0\n", + "Call Center 259203.0\n", + "Web 191681.0" + ] + }, + "execution_count": 60, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pivot_df = merged_df.pivot_table(index='sales_channel', values=['revenue'], aggfunc='sum')\n", + "pivot_df[\"revenue\"] = pivot_df[\"revenue\"].round(2)\n", + "pivot_df.head(5)" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "id": "170e5377-7a43-4339-8144-1818d829e005", + "metadata": {}, + "outputs": [], + "source": [ + "# Agents bring the most revenue for the company, followed by Branch, Call Center, and Web last" + ] + }, + { + "cell_type": "markdown", + "id": "640993b2-a291-436c-a34d-a551144f8196", + "metadata": { + "id": "640993b2-a291-436c-a34d-a551144f8196" + }, + "source": [ + "2. Create a pivot table that shows the average customer lifetime value per gender and education level. Analyze the resulting table to draw insights." + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "id": "ba125153-9b1d-46a5-a52e-c2aa1df8b601", + "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", + "
customer_lifetime_value
educationBachelorCollegeDoctorHigh School or BelowMaster
gender
F7984.9109977762.2715007203.9716708572.4771478304.774639
M7694.9275807997.1835417570.9884417914.0194707953.182676
\n", + "
" + ], + "text/plain": [ + " customer_lifetime_value \\\n", + "education Bachelor College Doctor \n", + "gender \n", + "F 7984.910997 7762.271500 7203.971670 \n", + "M 7694.927580 7997.183541 7570.988441 \n", + "\n", + " \n", + "education High School or Below Master \n", + "gender \n", + "F 8572.477147 8304.774639 \n", + "M 7914.019470 7953.182676 " + ] + }, + "execution_count": 64, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pivot_2_df = merged_df.pivot_table(index='gender', columns=\"education\", values=['customer_lifetime_value'], aggfunc='mean')\n", + "pivot_2_df" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "id": "ffbb0d6c-dbba-4b62-aed9-d502570e7859", + "metadata": {}, + "outputs": [], + "source": [ + "# using the pivot table above, we can see that th total lifetime value for females is bigger than for males, \n", + "# with results varying across education level, but not at an extent that we se significant differences." + ] + }, + { + "cell_type": "markdown", + "id": "32c7f2e5-3d90-43e5-be33-9781b6069198", + "metadata": { + "id": "32c7f2e5-3d90-43e5-be33-9781b6069198" + }, + "source": [ + "## Bonus\n", + "\n", + "You work at the customer service department and you want to know which months had the highest number of complaints by policy type category. Create a summary table showing the number of complaints by policy type and month.\n", + "Show it in a long format table." + ] + }, + { + "cell_type": "markdown", + "id": "e3d09a8f-953c-448a-a5f8-2e5a8cca7291", + "metadata": { + "id": "e3d09a8f-953c-448a-a5f8-2e5a8cca7291" + }, + "source": [ + "*In data analysis, a long format table is a way of structuring data in which each observation or measurement is stored in a separate row of the table. The key characteristic of a long format table is that each column represents a single variable, and each row represents a single observation of that variable.*\n", + "\n", + "*More information about long and wide format tables here: https://www.statology.org/long-vs-wide-data/*" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "id": "3a069e0b-b400-470e-904d-d17582191be4", + "metadata": { + "id": "3a069e0b-b400-470e-904d-d17582191be4" + }, + "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", + "
customerstatecustomer_lifetime_valueresponsecoverageeducationeffective_to_dateemploymentstatusgenderincome...sales_channeltotal_claim_amountvehicle_classvehicle_sizevehicle_typemonthmonthly_premium_auto_yrevenuenumber_of_open_complaints_ypolicy_type_y
0DK49336Arizona4809.216960NoBasicCollege2011-02-18EmployedM48029...Agent292.800000Four-Door CarMedsizeA261.0122.00Corporate Auto
1KX64629California2228.525238NoBasicCollege2011-01-18UnemployedF0...Call Center744.924331Four-Door CarMedsizeA164.064.00Personal Auto
2LZ68649Washington14947.917300NoBasicBachelor2011-02-10EmployedM22139...Call Center480.000000SUVMedsizeA2100.0200.00Personal Auto
3XL78013Oregon22332.439460YesExtendedCollege2011-01-11EmployedM49078...Branch484.013411Four-Door CarMedsizeA197.097.00Corporate Auto
4QA50777Oregon9025.067525NoPremiumBachelor2011-01-17Medical LeaveF23675...Branch707.925645Four-Door CarMedsizeA1117.0117.00Personal Auto
\n", + "

5 rows × 30 columns

\n", + "
" + ], + "text/plain": [ + " customer state customer_lifetime_value response coverage education \\\n", + "0 DK49336 Arizona 4809.216960 No Basic College \n", + "1 KX64629 California 2228.525238 No Basic College \n", + "2 LZ68649 Washington 14947.917300 No Basic Bachelor \n", + "3 XL78013 Oregon 22332.439460 Yes Extended College \n", + "4 QA50777 Oregon 9025.067525 No Premium Bachelor \n", + "\n", + " effective_to_date employmentstatus gender income ... sales_channel \\\n", + "0 2011-02-18 Employed M 48029 ... Agent \n", + "1 2011-01-18 Unemployed F 0 ... Call Center \n", + "2 2011-02-10 Employed M 22139 ... Call Center \n", + "3 2011-01-11 Employed M 49078 ... Branch \n", + "4 2011-01-17 Medical Leave F 23675 ... Branch \n", + "\n", + " total_claim_amount vehicle_class vehicle_size vehicle_type month \\\n", + "0 292.800000 Four-Door Car Medsize A 2 \n", + "1 744.924331 Four-Door Car Medsize A 1 \n", + "2 480.000000 SUV Medsize A 2 \n", + "3 484.013411 Four-Door Car Medsize A 1 \n", + "4 707.925645 Four-Door Car Medsize A 1 \n", + "\n", + " monthly_premium_auto_y revenue number_of_open_complaints_y policy_type_y \n", + "0 61.0 122.0 0 Corporate Auto \n", + "1 64.0 64.0 0 Personal Auto \n", + "2 100.0 200.0 0 Personal Auto \n", + "3 97.0 97.0 0 Corporate Auto \n", + "4 117.0 117.0 0 Personal Auto \n", + "\n", + "[5 rows x 30 columns]" + ] + }, + "execution_count": 70, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# first we need to bring in the merged_df table the values for \n", + "customer_service_df = merged_df.merge(\n", + " insurance_updated_df[[\"customer\", \"number_of_open_complaints\", \"policy_type\"]],\n", + " on=\"customer\",\n", + " how=\"inner\"\n", + ")\n", + "customer_service_df.head(5)\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "id": "2bc0acf5-e7a9-4701-9656-c6ce4728c0d5", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " month policy_type_y number_of_open_complaints_y\n", + "0 1 Corporate Auto 73\n", + "1 1 Personal Auto 363\n", + "2 1 Special Auto 15\n", + "3 2 Corporate Auto 78\n", + "4 2 Personal Auto 249\n", + "5 2 Special Auto 37\n" + ] + } + ], + "source": [ + "complaints = customer_service_df.groupby([\"month\", \"policy_type_y\"])[\"number_of_open_complaints_y\"].sum()\n", + "complaints_long = complaints.reset_index()\n", + "print(complaints_long)\n" + ] + } + ], + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "display_name": "Python [conda env:base] *", + "language": "python", + "name": "conda-base-py" + }, + "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.13.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/insurance_company_cleaned.csv b/insurance_company_cleaned.csv new file mode 100644 index 0000000..e2831e5 --- /dev/null +++ b/insurance_company_cleaned.csv @@ -0,0 +1,1072 @@ +customer,state,gender,education,customer_lifetime_value,income,monthly_premium_auto,number_of_open_complaints,policy_type,vehicle_class,total_claim_amount +RB50392,Washington,Unknown,Master,588174.235,0.0,1000.0,0,Personal Auto,Four-Door Car,2.704934 +QZ44356,Arizona,F,Bachelor,697953.59,0.0,94.0,0,Personal Auto,Four-Door Car,1131.464935 +AI49188,Nevada,F,Bachelor,1288743.17,48767.0,108.0,0,Personal Auto,Two-Door Car,566.472247 +WW63253,California,M,Bachelor,764586.18,0.0,106.0,0,Corporate Auto,SUV,529.881344 +GA49547,Washington,M,High School or Below,536307.65,36357.0,68.0,0,Personal Auto,Four-Door Car,17.269323 +OC83172,Oregon,F,Bachelor,825629.78,62902.0,69.0,0,Personal Auto,Two-Door Car,159.383042 +XZ87318,Oregon,F,College,538089.86,55350.0,67.0,0,Corporate Auto,Four-Door Car,321.6 +CF85061,Arizona,M,Master,721610.03,0.0,101.0,0,Corporate Auto,Four-Door Car,363.02968 +DY87989,Oregon,M,Bachelor,2412750.4,14072.0,71.0,0,Corporate Auto,Four-Door Car,511.2 +BQ94931,Oregon,F,College,738817.81,28812.0,93.0,0,Special Auto,Four-Door Car,425.527834 +SX51350,California,M,College,473899.2,0.0,67.0,0,Personal Auto,Four-Door Car,482.4 +VQ65197,California,Unknown,College,819719.71,0.0,110.0,0,Personal Auto,SUV,528.0 +DP39365,California,Unknown,Master,879879.7,77026.0,110.0,2,Corporate Auto,Four-Door Car,472.029737 +SJ95423,Arizona,Unknown,High School or Below,881901.89,99845.0,110.0,1,Corporate Auto,SUV,528.0 +IL66569,California,Unknown,College,538443.17,83689.0,70.0,2,Corporate Auto,Four-Door Car,307.139132 +BW63560,Oregon,Unknown,Bachelor,746313.94,24599.0,64.0,1,Corporate Auto,Four-Door Car,42.920271 +FV94802,Nevada,Unknown,High School or Below,256686.78,25049.0,67.0,0,Personal Auto,Two-Door Car,454.245098 +OE15005,California,Unknown,College,394524.16,28855.0,101.0,0,Personal Auto,SUV,647.442031 +WC83389,Oregon,Unknown,College,571033.31,51148.0,72.0,0,Personal Auto,Four-Door Car,308.981664 +FL50705,California,Unknown,High School or Below,816261.71,66140.0,101.0,0,Corporate Auto,Four-Door Car,484.8 +ZK25313,Oregon,Unknown,High School or Below,287205.13,57749.0,74.0,0,Personal Auto,Two-Door Car,355.2 +QK46697,Washington,M,Bachelor,617710.93,61040.0,79.0,1,Personal Auto,Two-Door Car,20.382876 +YH23384,Arizona,Unknown,Bachelor,2412750.4,14072.0,71.0,0,Personal Auto,Four-Door Car,511.2 +TZ98966,Nevada,Unknown,Bachelor,245019.1,0.0,73.0,3,Corporate Auto,Four-Door Car,554.376763 +HM55802,California,Unknown,Bachelor,239210.79,17870.0,61.0,0,Corporate Auto,Four-Door Car,439.2 +FS42516,Oregon,Unknown,College,580206.6,97541.0,72.0,0,Personal Auto,Four-Door Car,389.185006 +US89481,California,Unknown,Bachelor,394637.21,0.0,111.0,0,Personal Auto,Four-Door Car,799.2 +HS14476,Washington,M,College,916206.32,29723.0,80.0,0,Personal Auto,Four-Door Car,20.985105 +GE62437,Arizona,Unknown,College,1290256.01,86584.0,111.0,2,Personal Auto,Four-Door Car,532.8 +EJ77678,Oregon,Unknown,Master,323536.05,75690.0,80.0,1,Personal Auto,Four-Door Car,384.0 +SV85652,Arizona,Unknown,College,245458.35,23158.0,63.0,1,Personal Auto,Four-Door Car,322.294043 +UL64533,Nevada,Unknown,High School or Below,1897545.61,65999.0,237.0,0,Corporate Auto,Luxury,615.927769 +PF41800,California,Unknown,Bachelor,471532.13,0.0,65.0,0,Personal Auto,Four-Door Car,308.15089 +HD95276,Washington,F,College,473787.17,0.0,130.0,0,Personal Auto,SUV,23.820158 +SK67821,Oregon,Unknown,Bachelor,493291.63,37260.0,62.0,0,Corporate Auto,Four-Door Car,15.437681 +YV55495,Arizona,Unknown,High School or Below,574422.97,68987.0,71.0,0,Personal Auto,Four-Door Car,204.475147 +KY38074,California,Unknown,Bachelor,1389173.57,42305.0,117.0,0,Personal Auto,Four-Door Car,561.6 +DM79012,Oregon,Unknown,Master,738097.67,65706.0,91.0,0,Personal Auto,Four-Door Car,436.8 +CM61827,Oregon,Unknown,Bachelor,309003.41,0.0,90.0,0,Personal Auto,Two-Door Car,648.0 +WC35801,Arizona,Unknown,High School or Below,252163.31,53243.0,66.0,2,Personal Auto,Four-Door Car,157.397849 +QG25316,Nevada,Unknown,High School or Below,265206.18,0.0,70.0,1,Corporate Auto,Two-Door Car,484.318536 +MB98372,Oregon,Unknown,College,277104.5,50071.0,71.0,0,Corporate Auto,Two-Door Car,18.918935 +IL19217,California,Unknown,Bachelor,393900.64,60021.0,99.0,0,Personal Auto,Four-Door Car,882.871945 +SR38658,Arizona,Unknown,High School or Below,1223187.97,43244.0,103.0,0,Personal Auto,Luxury,494.4 +YD87931,Washington,M,Doctor,495165.61,46896.0,35354.0,1,Personal Auto,Four-Door Car,31.707317 +HG65722,Oregon,Unknown,Doctor,1281910.29,10105.0,172.0,3,Personal Auto,SUV,0.517753 +BU27331,Arizona,Unknown,Bachelor,446851.05,0.0,73.0,3,Personal Auto,Four-Door Car,579.165954 +XM45289,Oregon,Unknown,High School or Below,551434.4,23218.0,71.0,0,Personal Auto,Two-Door Car,447.79344 +KP34198,California,Unknown,Bachelor,334387.53,0.0,92.0,0,Corporate Auto,Four-Door Car,529.624084 +SH90947,Arizona,Unknown,High School or Below,229447.89,0.0,62.0,0,Personal Auto,Four-Door Car,313.023175 +WE95729,Oregon,Unknown,College,3670742.64,24804.0,104.0,0,Personal Auto,SUV,593.830288 +PY51963,California,Unknown,Bachelor,3347334.95,33190.0,106.0,0,Corporate Auto,SUV,508.8 +RB69909,Nevada,Unknown,High School or Below,798343.17,36014.0,69.0,3,Special Auto,Four-Door Car,173.956072 +NW21079,Washington,F,Master,487938.48,67163.0,61.0,2,Personal Auto,Two-Door Car,33.192803 +FR46645,California,Unknown,Bachelor,429399.73,16701.0,113.0,0,Personal Auto,Four-Door Car,831.625979 +SY17488,Arizona,Unknown,College,716439.55,46623.0,91.0,0,Corporate Auto,Four-Door Car,436.8 +AP67935,California,Unknown,College,761951.58,64749.0,64.0,0,Special Auto,Four-Door Car,302.56519 +FS37417,Arizona,Unknown,High School or Below,395800.28,0.0,101.0,0,Personal Auto,SUV,484.8 +ML29312,Oregon,Unknown,High School or Below,449949.33,16969.0,124.0,2,Personal Auto,SUV,704.768111 +UB61619,Oregon,Unknown,Master,405956.74,11621.0,108.0,0,Personal Auto,Four-Door Car,518.4 +CD86811,Arizona,Unknown,Bachelor,445811.34,17622.0,65.0,1,Personal Auto,Four-Door Car,312.0 +RU83859,California,Unknown,Bachelor,811033.31,11489.0,105.0,0,Personal Auto,Two-Door Car,504.0 +FG63582,Oregon,Unknown,Bachelor,333976.49,0.0,94.0,0,Personal Auto,Two-Door Car,863.327324 +NN71951,California,Unknown,High School or Below,2426101.78,66525.0,100.0,0,Personal Auto,SUV,104.331355 +WB37082,Arizona,Unknown,Bachelor,661397.37,0.0,63.0,0,Personal Auto,Four-Door Car,676.391482 +SM52139,Washington,Unknown,College,293069.35,33663.0,73.0,0,Personal Auto,Four-Door Car,350.4 +FL82372,Oregon,Unknown,College,867219.43,22547.0,112.0,0,Corporate Auto,SUV,537.6 +DP45816,Arizona,Unknown,High School or Below,1163866.93,61486.0,97.0,0,Personal Auto,Two-Door Car,465.258644 +GW33762,Oregon,Unknown,Bachelor,684615.03,0.0,95.0,0,Personal Auto,Two-Door Car,456.0 +RZ33670,California,Unknown,College,1172777.65,29879.0,102.0,0,Personal Auto,Four-Door Car,500.254235 +PY70169,Oregon,Unknown,High School or Below,2264383.48,93011.0,113.0,0,Personal Auto,SUV,281.451042 +MO91628,Oregon,Unknown,Master,261447.43,65186.0,65.0,0,Personal Auto,Two-Door Car,5.434505 +HW87852,Oregon,Unknown,Master,245175.27,26840.0,64.0,2,Personal Auto,Four-Door Car,307.2 +HB20453,Oregon,Unknown,Bachelor,678127.02,0.0,104.0,1,Personal Auto,Luxury,982.399613 +BN87372,Oregon,Unknown,Bachelor,497480.15,75644.0,65.0,3,Personal Auto,Two-Door Car,467.803638 +YX23800,Oregon,Unknown,Bachelor,859160.49,38984.0,73.0,0,Personal Auto,Four-Door Car,350.4 +DZ87709,Oregon,Unknown,High School or Below,559216.14,71811.0,71.0,0,Personal Auto,Four-Door Car,29.03416 +XW13033,Nevada,Unknown,College,800947.28,20961.0,67.0,0,Personal Auto,Four-Door Car,321.6 +SP81997,Washington,F,Master,588174.235,41275.0,96.0,0,Personal Auto,Four-Door Car,41.122303 +OM82309,California,Unknown,Bachelor,5816655.35,61321.0,186.0,1,Personal Auto,Luxury,427.63121 +ZU35962,California,Unknown,College,802522.94,0.0,77.0,0,Personal Auto,Two-Door Car,25.807685 +VH85817,California,Unknown,High School or Below,578018.22,51066.0,74.0,0,Personal Auto,Four-Door Car,787.993313 +DT85712,California,Unknown,Doctor,411853.91,34378.0,102.0,0,Personal Auto,SUV,489.6 +YJ88573,Nevada,Unknown,Master,252307.02,43072.0,63.0,0,Personal Auto,Four-Door Car,302.4 +SQ19467,Oregon,Unknown,College,655421.64,25222.0,90.0,0,Personal Auto,Four-Door Car,475.623251 +YB66933,Washington,F,Bachelor,538275.2,77552.0,68.0,1,Corporate Auto,Four-Door Car,45.215059 +ET79815,California,Unknown,College,592672.94,23091.0,96.0,5,Personal Auto,Four-Door Car,460.8 +QC35222,California,Unknown,Bachelor,268347.07,48269.0,69.0,3,Corporate Auto,Four-Door Car,282.151207 +CJ15590,Oregon,Unknown,Bachelor,269518.24,32720.0,67.0,0,Personal Auto,Four-Door Car,321.6 +OI48267,California,Unknown,College,604702.52,20396.0,76.0,1,Personal Auto,Four-Door Car,364.8 +JY67916,Oregon,Unknown,College,1317101.28,21513.0,119.0,1,Personal Auto,Two-Door Car,679.827592 +OW15518,Washington,F,College,1595001.95,0.0,87.0,1,Personal Auto,Two-Door Car,46.041452 +CZ33664,Oregon,Unknown,Bachelor,252765.38,80744.0,63.0,0,Corporate Auto,Four-Door Car,11.879037 +WK30175,Oregon,Unknown,Bachelor,267209.58,52822.0,67.0,0,Corporate Auto,Two-Door Car,350.529033 +ON44465,California,Unknown,High School or Below,531329.4,0.0,77.0,1,Personal Auto,Four-Door Car,863.3947 +TV87155,Oregon,Unknown,Bachelor,2094619.25,69738.0,74.0,1,Personal Auto,Four-Door Car,492.127532 +KH48895,Arizona,Unknown,Master,837535.39,17780.0,109.0,0,Personal Auto,SUV,132.588288 +NZ30757,California,Unknown,Bachelor,480166.15,18107.0,62.0,0,Personal Auto,Four-Door Car,297.6 +RI22468,Arizona,Unknown,Bachelor,574594.33,57740.0,74.0,3,Personal Auto,Four-Door Car,269.905129 +FZ30935,Oregon,Unknown,College,606611.6,32627.0,76.0,0,Personal Auto,Two-Door Car,380.036697 +UG93476,California,Unknown,College,800230.83,0.0,107.0,0,Personal Auto,SUV,513.6 +AB96670,California,Unknown,College,239391.54,0.0,70.0,0,Personal Auto,Four-Door Car,425.266308 +XK64261,Oregon,Unknown,Bachelor,476281.79,65795.0,62.0,1,Corporate Auto,Two-Door Car,49.011099 +EV68375,California,Unknown,College,433038.6,60475.0,107.0,0,Personal Auto,Four-Door Car,513.6 +UN51653,California,Unknown,High School or Below,940272.98,0.0,130.0,0,Personal Auto,SUV,936.0 +TO96662,Oregon,Unknown,Bachelor,696669.45,41837.0,88.0,0,Personal Auto,Four-Door Car,142.062768 +MR52087,California,Unknown,Bachelor,769406.43,32303.0,65.0,0,Personal Auto,Four-Door Car,45.152521 +DE75225,Oregon,Unknown,High School or Below,871756.11,0.0,117.0,1,Personal Auto,SUV,561.6 +EP80820,California,Unknown,Bachelor,592874.85,40531.0,74.0,0,Personal Auto,Two-Door Car,30.567357 +GU99037,Oregon,Unknown,College,245297.73,79898.0,62.0,1,Corporate Auto,Four-Door Car,271.606799 +WI57118,California,Unknown,College,670157.17,56398.0,85.0,0,Personal Auto,Four-Door Car,408.0 +GP39118,Washington,M,High School or Below,499655.27,71600.0,63.0,0,Personal Auto,Two-Door Car,46.158117 +MQ14219,Arizona,Unknown,College,849269.88,27804.0,109.0,0,Personal Auto,SUV,784.8 +KN20603,Oregon,Unknown,Bachelor,771349.4,45506.0,66.0,2,Personal Auto,Four-Door Car,316.8 +SG20925,Washington,F,Master,518579.76,99428.0,6464.0,1,Personal Auto,Four-Door Car,48.046869 +JI70886,California,Unknown,High School or Below,729006.98,0.0,102.0,1,Corporate Auto,SUV,489.6 +VF72557,Oregon,Unknown,High School or Below,477294.38,20993.0,133.0,0,Personal Auto,SUV,638.4 +OX28638,Arizona,Unknown,High School or Below,680649.14,37839.0,86.0,0,Personal Auto,Two-Door Car,465.633954 +SK55033,California,Unknown,Bachelor,246978.13,92711.0,62.0,0,Personal Auto,Two-Door Car,368.400146 +OO88645,California,Unknown,College,310392.3,74665.0,78.0,2,Corporate Auto,Four-Door Car,236.902001 +FM14335,Washington,F,College,1048491.54,61108.0,89.0,0,Personal Auto,Four-Door Car,49.451117 +CW82151,California,Unknown,Bachelor,890273.76,46833.0,112.0,0,Personal Auto,Luxury,64.109663 +DY22043,Oregon,Unknown,High School or Below,549944.72,88768.0,68.0,0,Personal Auto,Two-Door Car,326.4 +SH36774,California,Unknown,High School or Below,1502359.86,28262.0,192.0,0,Personal Auto,Luxury,921.6 +EM43724,Nevada,Unknown,Bachelor,250910.79,33555.0,63.0,0,Personal Auto,Four-Door Car,101.89645 +FH85960,Oregon,Unknown,College,3122174.81,42780.0,113.0,1,Personal Auto,Four-Door Car,542.4 +XA55993,Oregon,Unknown,Master,313350.34,58850.0,78.0,0,Personal Auto,Four-Door Car,143.747794 +GO36627,Arizona,Unknown,College,383745.19,21880.0,97.0,0,Special Auto,Four-Door Car,424.077159 +QH48047,Oregon,Unknown,College,1179049.62,25251.0,66.0,0,Personal Auto,Four-Door Car,316.8 +HS28694,Washington,F,High School or Below,282986.39,25317.0,71.0,0,Personal Auto,Two-Door Car,50.422181 +UH65059,Arizona,Unknown,High School or Below,430580.83,24188.0,109.0,0,Personal Auto,Luxury,523.2 +FV21968,Nevada,Unknown,Bachelor,597397.69,41611.0,74.0,0,Special Auto,Four-Door Car,113.801497 +QA87025,Oregon,Unknown,Bachelor,567044.24,28406.0,72.0,1,Personal Auto,Four-Door Car,192.87572 +TQ13499,Arizona,Unknown,College,473174.93,69833.0,118.0,0,Personal Auto,Four-Door Car,828.662719 +BU44523,Arizona,Unknown,High School or Below,802637.96,0.0,74.0,0,Corporate Auto,Four-Door Car,532.8 +MS41162,Arizona,Unknown,High School or Below,402296.35,0.0,117.0,0,Personal Auto,SUV,975.107098 +PU25891,Oregon,Unknown,High School or Below,961831.09,80536.0,119.0,0,Special Auto,Luxury,53.798708 +LH92841,Washington,F,Bachelor,725595.38,88891.0,89.0,0,Personal Auto,Four-Door Car,50.528355 +SX26335,Oregon,Unknown,College,955292.69,97732.0,79.0,0,Personal Auto,Four-Door Car,289.9122 +AZ95587,Arizona,F,Bachelor,1038855.32,61222.0,89.0,0,Special Auto,Four-Door Car,392.604371 +DS81757,Oregon,M,College,247012.12,0.0,74.0,0,Personal Auto,Two-Door Car,721.242206 +OJ94107,Arizona,M,Master,561906.85,50335.0,140.0,0,Personal Auto,SUV,456.52385 +LP84436,California,F,High School or Below,904711.92,0.0,127.0,0,Personal Auto,Luxury,1087.995426 +FF22360,Washington,F,Doctor,268731.41,82210.0,68.0,4,Personal Auto,Four-Door Car,51.961915 +LM19287,Oregon,F,High School or Below,373150.46,0.0,96.0,0,Personal Auto,Four-Door Car,460.8 +ZU18643,Nevada,M,Bachelor,366077.03,64495.0,92.0,0,Corporate Auto,Four-Door Car,251.992083 +AZ82578,California,F,College,792882.93,0.0,72.0,0,Corporate Auto,Four-Door Car,345.6 +XC67861,Arizona,F,Bachelor,501175.16,28859.0,67.0,3,Corporate Auto,Two-Door Car,321.6 +YC43143,Arizona,F,High School or Below,798825.83,77330.0,99.0,0,Personal Auto,Four-Door Car,99.257608 +EK59571,Oregon,M,College,388545.64,0.0,105.0,0,Corporate Auto,Four-Door Car,504.0 +PA38372,Washington,F,High School or Below,935773.78,33060.0,117.0,0,Personal Auto,Four-Door Car,56.731578 +RO18530,Washington,M,Master,254068.98,42557.0,65.0,0,Personal Auto,Four-Door Car,57.562324 +PD27940,Arizona,M,High School or Below,488516.25,26372.0,126.0,0,Personal Auto,SUV,604.8 +BS77946,Arizona,F,Bachelor,975330.71,17514.0,127.0,0,Personal Auto,SUV,8.312729 +YM50253,California,F,Bachelor,294615.37,89270.0,74.0,0,Personal Auto,Four-Door Car,316.599228 +NR15332,California,M,High School or Below,258111.09,29757.0,65.0,0,Personal Auto,Four-Door Car,312.0 +RC62865,Oregon,M,College,351738.58,51814.0,92.0,0,Personal Auto,Four-Door Car,56.300724 +CC15295,Oregon,F,Bachelor,974335.01,24028.0,82.0,0,Personal Auto,Four-Door Car,393.6 +KA61892,Arizona,M,College,387364.7,28142.0,105.0,0,Personal Auto,Luxury,701.708239 +OS94884,Arizona,F,Bachelor,764928.2,52705.0,64.0,1,Personal Auto,Two-Door Car,128.705563 +ND87334,California,M,High School or Below,228759.69,0.0,63.0,0,Corporate Auto,Two-Door Car,679.368378 +OY51402,Washington,F,High School or Below,825576.39,54040.0,103.0,0,Personal Auto,SUV,59.987126 +YL74911,California,F,College,871492.21,0.0,118.0,0,Personal Auto,SUV,566.4 +GK92563,Washington,F,Doctor,681923.12,22492.0,85.0,0,Personal Auto,Two-Door Car,61.654262 +HL53154,California,M,Bachelor,741619.73,0.0,77.0,2,Personal Auto,Four-Door Car,554.4 +RI78966,Oregon,M,Master,777115.9,21876.0,68.0,0,Personal Auto,Four-Door Car,465.41477 +IC13702,California,F,Bachelor,696834.19,0.0,69.0,1,Personal Auto,Four-Door Car,496.8 +BE10809,California,F,High School or Below,425028.26,0.0,61.0,1,Personal Auto,Four-Door Car,292.8 +HT87217,Oregon,F,High School or Below,1977656.65,70699.0,82.0,0,Personal Auto,Four-Door Car,256.813837 +TH95618,California,F,High School or Below,2134346.6,0.0,74.0,1,Personal Auto,Four-Door Car,355.2 +TS19868,California,M,College,241313.97,27501.0,63.0,0,Personal Auto,Four-Door Car,542.319401 +LP45550,Oregon,F,Doctor,1536384.72,15897.0,101.0,0,Personal Auto,Four-Door Car,303.148399 +QR87004,Nevada,F,College,845696.19,25141.0,73.0,1,Personal Auto,Four-Door Car,25.438063 +OE75747,Nevada,F,College,218964.25,0.0,61.0,3,Personal Auto,Four-Door Car,292.8 +DX91392,California,M,High School or Below,578018.22,51066.0,74.0,0,Personal Auto,Four-Door Car,787.993313 +AB72731,California,F,Bachelor,463998.16,28358.0,117.0,0,Personal Auto,Luxury,84.024413 +GX84338,Washington,F,Doctor,382443.13,62530.0,95.0,0,Personal Auto,Four-Door Car,61.693771 +IS12901,Arizona,F,Bachelor,596811.89,90972.0,74.0,0,Personal Auto,Two-Door Car,232.926145 +BN90616,Washington,F,Bachelor,859033.5,63110.0,72.0,0,Personal Auto,Four-Door Car,68.179721 +HH90090,California,F,Bachelor,407663.47,29549.0,104.0,0,Personal Auto,Luxury,710.433775 +IU25463,California,F,Bachelor,1225260.18,0.0,115.0,1,Personal Auto,Four-Door Car,552.0 +KC11055,Nevada,F,Bachelor,1693627.15,39411.0,217.0,2,Personal Auto,Luxury,1122.658899 +PD33979,Oregon,M,High School or Below,489243.55,21709.0,62.0,0,Personal Auto,Four-Door Car,408.374746 +NK71023,Nevada,M,Bachelor,994230.48,67890.0,85.0,0,Personal Auto,Four-Door Car,408.0 +AB13432,California,M,Bachelor,373583.81,0.0,110.0,0,Personal Auto,SUV,792.0 +OZ97704,California,F,High School or Below,1311752.22,84311.0,111.0,4,Personal Auto,SUV,532.8 +UF46533,California,F,College,457452.41,99316.0,114.0,0,Corporate Auto,SUV,754.358929 +XP47431,Arizona,F,Bachelor,547006.06,54507.0,138.0,0,Personal Auto,SUV,702.990032 +GK73582,California,F,Bachelor,297884.6,64586.0,76.0,0,Personal Auto,Four-Door Car,206.837111 +RV98763,Oregon,M,College,641096.75,61709.0,82.0,2,Personal Auto,Four-Door Car,275.395894 +II62831,California,M,Master,447902.31,94656.0,111.0,1,Special Auto,SUV,459.738128 +XK33449,California,F,High School or Below,238373.19,0.0,69.0,0,Special Auto,Two-Door Car,496.8 +TR85083,California,M,Bachelor,276449.37,61085.0,70.0,1,Personal Auto,Two-Door Car,336.0 +EO95328,Oregon,F,Bachelor,792010.54,89284.0,67.0,3,Personal Auto,Two-Door Car,321.6 +EN21086,Arizona,F,High School or Below,688909.8,0.0,63.0,0,Personal Auto,Four-Door Car,302.4 +YL83902,Washington,F,Bachelor,327419.46,31686.0,81.0,0,Personal Auto,Four-Door Car,430.994107 +AZ62651,Oregon,M,High School or Below,995170.77,56855.0,255.0,0,Corporate Auto,Luxury,1836.0 +ZW25874,Oregon,M,Bachelor,252155.57,53703.0,67.0,2,Special Auto,Four-Door Car,67.632476 +EH41854,Washington,F,High School or Below,2370611.34,0.0,96.0,1,Personal Auto,Two-Door Car,844.481918 +MW70227,California,M,College,604702.52,20396.0,76.0,1,Personal Auto,Four-Door Car,364.8 +SL22297,California,F,Master,1114030.25,27679.0,150.0,0,Personal Auto,SUV,722.486994 +RV14138,Nevada,F,Bachelor,433406.41,23904.0,123.0,3,Personal Auto,SUV,590.4 +UO62808,Arizona,F,High School or Below,279974.79,65351.0,69.0,0,Corporate Auto,Four-Door Car,481.027516 +ZX64745,California,M,College,792313.66,0.0,113.0,0,Personal Auto,SUV,1124.427734 +FL34139,California,M,High School or Below,368811.09,0.0,63.0,3,Personal Auto,Four-Door Car,669.682001 +TS11219,California,M,College,1206745.6,0.0,116.0,0,Personal Auto,SUV,1284.093173 +XX12304,California,F,College,292497.67,64459.0,72.0,0,Personal Auto,Four-Door Car,240.259479 +SD64087,California,M,College,1501409.27,32961.0,190.0,0,Corporate Auto,SUV,912.0 +OY38576,Oregon,F,High School or Below,927723.38,71416.0,116.0,0,Corporate Auto,SUV,556.8 +BG76355,Washington,F,Bachelor,627412.39,68964.0,78.0,0,Personal Auto,Four-Door Car,115.086827 +IP66913,California,M,High School or Below,388664.74,78108.0,98.0,0,Personal Auto,Two-Door Car,470.4 +LE95702,California,M,College,438627.76,10621.0,67.0,0,Special Auto,Four-Door Car,321.6 +KX54357,Washington,M,College,1136526.77,84910.0,95.0,0,Corporate Auto,Two-Door Car,383.167471 +EZ78112,California,F,High School or Below,561096.43,77493.0,70.0,0,Special Auto,Four-Door Car,307.963291 +XN16891,Arizona,M,College,291289.2,81097.0,74.0,0,Personal Auto,Four-Door Car,355.2 +XK31350,Oregon,F,College,691572.99,96610.0,85.0,0,Corporate Auto,Four-Door Car,520.364752 +CC30924,Oregon,M,College,626266.33,30110.0,159.0,0,Corporate Auto,Luxury,466.436375 +IT78748,Oregon,F,High School or Below,650339.7,22081.0,84.0,0,Special Auto,Two-Door Car,451.670309 +KY33386,Washington,F,High School or Below,800739.94,0.0,112.0,0,Personal Auto,Luxury,537.6 +CO44221,California,M,College,292991.65,98473.0,72.0,0,Personal Auto,Four-Door Car,345.6 +LK60013,Oregon,F,Bachelor,596955.3,97431.0,74.0,0,Personal Auto,Four-Door Car,355.2 +DE21533,California,M,Bachelor,547315.99,93870.0,69.0,0,Personal Auto,Four-Door Car,331.2 +YS94121,Nevada,M,High School or Below,564539.67,50366.0,72.0,0,Personal Auto,Four-Door Car,428.734656 +UK68427,Washington,M,High School or Below,636926.24,34498.0,83.0,0,Personal Auto,Two-Door Car,398.4 +TE49565,Oregon,F,College,1183376.73,16552.0,103.0,0,Personal Auto,SUV,494.4 +RA88421,Oregon,F,College,612110.79,26787.0,77.0,0,Personal Auto,Four-Door Car,369.6 +KQ51983,Nevada,M,College,515936.97,0.0,74.0,0,Personal Auto,Two-Door Car,831.752839 +CD88896,Nevada,F,High School or Below,251459.2,43860.0,65.0,0,Corporate Auto,Four-Door Car,156.124914 +YV22553,Arizona,M,High School or Below,866861.13,21474.0,114.0,2,Corporate Auto,SUV,373.428187 +WU14435,California,M,Bachelor,496096.54,18174.0,66.0,0,Corporate Auto,Four-Door Car,395.934815 +XV84099,Arizona,F,Bachelor,550413.9,0.0,73.0,0,Corporate Auto,Four-Door Car,350.4 +RI24911,Arizona,M,College,750745.54,60920.0,64.0,0,Personal Auto,Two-Door Car,231.201886 +KO26461,Arizona,M,High School or Below,3226985.14,41520.0,90.0,0,Personal Auto,Four-Door Car,289.904105 +HI14283,Oregon,F,Bachelor,565703.16,0.0,152.0,0,Personal Auto,SUV,729.6 +PT50227,Arizona,M,High School or Below,506175.79,0.0,68.0,0,Personal Auto,Two-Door Car,326.4 +BH36570,California,M,Bachelor,591278.38,72208.0,73.0,0,Personal Auto,Two-Door Car,350.4 +TX17484,California,F,Bachelor,1518227.98,53863.0,63.0,0,Personal Auto,Four-Door Car,105.765111 +CT41158,Washington,M,College,1074703.09,66446.0,136.0,0,Corporate Auto,SUV,639.464548 +AO87348,Washington,M,College,205062.35,0.0,61.0,0,Personal Auto,Four-Door Car,292.8 +DE55857,Washington,F,Bachelor,246544.49,64997.0,63.0,1,Personal Auto,Four-Door Car,383.442328 +LF66923,Nevada,F,High School or Below,534312.13,64460.0,66.0,0,Corporate Auto,Two-Door Car,316.8 +CN24514,Arizona,F,College,811982.91,46618.0,67.0,0,Personal Auto,Four-Door Car,99.085943 +UW32074,Oregon,F,College,460526.52,0.0,64.0,0,Corporate Auto,Four-Door Car,307.2 +HP36979,California,M,College,640878.56,49988.0,84.0,5,Personal Auto,Two-Door Car,566.935022 +PP40919,California,F,College,237653.35,0.0,91.0,5,Personal Auto,Two-Door Car,436.8 +RO73268,California,M,Bachelor,321107.0,16269.0,86.0,0,Corporate Auto,Two-Door Car,412.8 +HO61691,Arizona,F,Bachelor,509452.23,72006.0,64.0,0,Personal Auto,Four-Door Car,307.2 +BS13062,Arizona,F,High School or Below,2575527.82,0.0,81.0,2,Personal Auto,Four-Door Car,388.8 +FO35655,Oregon,M,Bachelor,867222.97,0.0,245.0,0,Corporate Auto,Luxury,2345.413441 +HR10526,California,M,Master,804473.07,44320.0,67.0,0,Personal Auto,Four-Door Car,321.6 +IA63417,Arizona,F,High School or Below,400151.91,19782.0,108.0,0,Personal Auto,Two-Door Car,773.470977 +BH35016,Nevada,F,Bachelor,1670611.7,63933.0,70.0,0,Personal Auto,Two-Door Car,424.883448 +PK52952,Arizona,M,Doctor,854441.11,28224.0,109.0,0,Personal Auto,SUV,523.2 +OD76309,Washington,F,College,780531.29,21073.0,106.0,1,Personal Auto,SUV,508.8 +IL28481,Oregon,M,Bachelor,611275.69,63243.0,77.0,0,Personal Auto,Four-Door Car,364.240307 +GY55092,Nevada,M,High School or Below,477294.38,20993.0,133.0,0,Personal Auto,SUV,638.4 +UF33451,Oregon,F,Bachelor,1097909.56,94827.0,135.0,0,Personal Auto,SUV,354.729129 +CF15558,California,F,Master,500426.38,39161.0,63.0,1,Personal Auto,Two-Door Car,283.995953 +JM62924,Washington,M,Bachelor,1322304.38,37534.0,84.0,2,Personal Auto,Four-Door Car,403.2 +EM66435,Oregon,F,Bachelor,262331.54,80210.0,65.0,0,Corporate Auto,Four-Door Car,20.543176 +QX45933,California,M,Bachelor,1784019.56,0.0,62.0,0,Personal Auto,Four-Door Car,385.115437 +JI71369,California,F,College,510611.18,30110.0,64.0,0,Personal Auto,Four-Door Car,140.165035 +JU93290,Arizona,F,College,1793060.45,21708.0,68.0,0,Personal Auto,Four-Door Car,326.4 +GU66096,Arizona,M,High School or Below,545734.26,94731.0,67.0,0,Personal Auto,Four-Door Car,321.6 +UC33108,California,M,Bachelor,656364.41,32375.0,83.0,0,Personal Auto,Four-Door Car,398.4 +LW93867,Oregon,M,College,481252.52,16531.0,63.0,0,Corporate Auto,Four-Door Car,102.879769 +OU78470,Arizona,F,Master,2932804.19,32006.0,94.0,0,Corporate Auto,Four-Door Car,56.868289 +XW90265,Arizona,F,Bachelor,577352.07,81676.0,72.0,0,Personal Auto,Two-Door Car,463.158502 +HS67749,California,M,College,684711.89,71038.0,86.0,0,Corporate Auto,Four-Door Car,205.444066 +VZ51506,Arizona,F,High School or Below,359531.29,0.0,103.0,0,Corporate Auto,Luxury,741.6 +UI64281,Nevada,F,Master,2285561.21,20832.0,65.0,0,Personal Auto,Two-Door Car,56.371967 +AE98193,Washington,M,High School or Below,785941.46,0.0,113.0,0,Personal Auto,SUV,813.6 +AZ74055,Oregon,M,High School or Below,411557.74,52405.0,103.0,0,Personal Auto,Four-Door Car,494.4 +XS76911,Arizona,F,High School or Below,502963.88,0.0,133.0,0,Personal Auto,Luxury,795.864079 +AY40674,Washington,F,Bachelor,482141.85,26583.0,1005.0,4,Personal Auto,SUV,614.4 +NA12740,Oregon,M,Master,500431.05,25486.0,65.0,0,Special Auto,Two-Door Car,72.438681 +UA84837,Arizona,M,College,863005.39,24065.0,111.0,0,Corporate Auto,Four-Door Car,532.8 +DJ51510,Arizona,F,High School or Below,932208.51,70435.0,116.0,0,Personal Auto,Four-Door Car,67.881546 +VM58985,California,M,College,1672756.06,0.0,76.0,2,Personal Auto,Two-Door Car,402.636829 +OH60605,Oregon,F,High School or Below,365253.24,39679.0,92.0,0,Personal Auto,Two-Door Car,641.388616 +UO98052,Nevada,M,College,615860.12,0.0,89.0,0,Personal Auto,Four-Door Car,342.481173 +NC53424,California,M,Bachelor,437608.4,0.0,69.0,4,Personal Auto,Two-Door Car,331.2 +LQ13873,Nevada,M,High School or Below,556945.62,53565.0,71.0,1,Personal Auto,Four-Door Car,340.8 +LA97014,Washington,M,Bachelor,257651.3,37574.0,66.0,1,Personal Auto,Two-Door Car,412.101933 +NB79936,Washington,M,Bachelor,834698.32,48259.0,108.0,0,Personal Auto,Two-Door Car,73.700573 +NT89061,Arizona,F,High School or Below,632392.39,78532.0,78.0,0,Personal Auto,Four-Door Car,374.4 +AF10970,Arizona,F,Bachelor,597314.34,96163.0,73.0,0,Corporate Auto,Four-Door Car,350.4 +ZG48513,California,M,Bachelor,470667.7,0.0,72.0,0,Personal Auto,Four-Door Car,345.6 +JQ59145,California,M,High School or Below,809341.03,0.0,114.0,1,Personal Auto,Luxury,722.024742 +FE84989,Washington,M,College,503574.46,72672.0,63.0,0,Personal Auto,Four-Door Car,259.361117 +JT52858,Oregon,F,Bachelor,902786.72,99002.0,112.0,1,Personal Auto,Four-Door Car,537.6 +MC62068,California,M,High School or Below,728888.48,79494.0,91.0,0,Personal Auto,Four-Door Car,396.295614 +EU27538,Oregon,M,Master,1804247.94,35704.0,225.0,0,Personal Auto,Luxury,358.281562 +RH42306,Arizona,F,Bachelor,499206.3,0.0,71.0,0,Corporate Auto,Four-Door Car,653.388564 +US23612,Oregon,F,High School or Below,910226.78,26049.0,118.0,0,Personal Auto,Two-Door Car,121.032372 +WV76014,Arizona,M,Doctor,254040.77,70125.0,64.0,0,Special Auto,Four-Door Car,92.813396 +RK96223,California,M,College,1294189.19,52369.0,110.0,1,Personal Auto,SUV,528.0 +MF82000,Washington,F,Bachelor,236534.86,0.0,66.0,2,Special Auto,Four-Door Car,159.636956 +FM46980,Arizona,M,College,572076.51,41770.0,72.0,0,Personal Auto,Four-Door Car,476.156957 +SY56792,Oregon,M,High School or Below,703553.41,0.0,101.0,0,Corporate Auto,Four-Door Car,727.2 +RF61565,California,M,College,263697.77,31911.0,67.0,0,Personal Auto,Four-Door Car,321.6 +IM94808,Nevada,M,Bachelor,539583.2,70051.0,68.0,0,Corporate Auto,Four-Door Car,42.078345 +VI14730,Oregon,M,High School or Below,838263.01,19683.0,117.0,1,Personal Auto,Luxury,561.6 +YR34119,Washington,F,College,3116174.52,30916.0,112.0,0,Personal Auto,SUV,200.11606 +RR77985,Oregon,F,Bachelor,288774.23,0.0,80.0,0,Personal Auto,Four-Door Car,676.944023 +QD28391,Washington,M,College,742584.53,84302.0,62.0,0,Personal Auto,Four-Door Car,76.609295 +WV17090,California,M,Bachelor,2558572.78,0.0,116.0,0,Corporate Auto,SUV,830.623064 +TM23514,Oregon,M,College,1027260.82,60145.0,132.0,0,Personal Auto,SUV,580.473259 +MQ68407,Oregon,F,Bachelor,437636.36,63774.0,111.0,0,Personal Auto,Four-Door Car,60.036683 +GJ59592,California,F,Bachelor,531889.66,25134.0,67.0,0,Corporate Auto,Four-Door Car,321.6 +FY56083,Oregon,M,Bachelor,471976.22,37057.0,61.0,1,Personal Auto,Four-Door Car,47.53101 +UA94723,Oregon,F,High School or Below,442803.16,58577.0,110.0,0,Personal Auto,SUV,303.872752 +FW91032,California,M,High School or Below,587917.61,85857.0,73.0,0,Corporate Auto,Four-Door Car,100.620067 +DE34457,Oregon,F,Doctor,941690.85,70602.0,116.0,0,Personal Auto,SUV,481.339891 +HD32044,Oregon,F,Master,828815.56,33816.0,106.0,2,Corporate Auto,Four-Door Car,508.8 +HH30454,Oregon,M,Bachelor,3265483.83,0.0,153.0,0,Personal Auto,SUV,1101.6 +AH84063,Oregon,F,College,471945.01,89642.0,121.0,4,Corporate Auto,SUV,86.320022 +QA17596,California,F,Bachelor,390347.48,60068.0,98.0,0,Personal Auto,Two-Door Car,470.4 +XI41052,California,F,Bachelor,545725.97,50044.0,139.0,0,Personal Auto,SUV,667.2 +DI30528,California,F,Master,272535.64,36650.0,69.0,1,Personal Auto,Four-Door Car,56.60333 +SC66359,Arizona,F,College,443397.37,50653.0,110.0,0,Corporate Auto,SUV,262.865172 +EN61670,Arizona,F,Doctor,533246.27,68931.0,66.0,0,Personal Auto,Four-Door Car,309.577946 +DQ10761,Oregon,M,Bachelor,231509.5,0.0,73.0,1,Corporate Auto,Four-Door Car,350.4 +BQ51587,California,F,College,541195.37,0.0,73.0,0,Personal Auto,Four-Door Car,365.364581 +JE21522,California,M,Bachelor,958733.23,39266.0,80.0,0,Personal Auto,Four-Door Car,384.0 +WS47147,California,M,College,2210350.72,0.0,102.0,0,Personal Auto,SUV,489.6 +ZA64638,Nevada,F,High School or Below,976494.53,0.0,98.0,1,Personal Auto,Four-Door Car,705.6 +EW38459,Nevada,F,Bachelor,256715.15,40864.0,65.0,0,Corporate Auto,Four-Door Car,9.51528 +QW87316,Oregon,F,College,265062.28,39035.0,68.0,0,Personal Auto,Four-Door Car,244.564334 +IC43478,California,M,Bachelor,1126436.33,34923.0,98.0,0,Personal Auto,Two-Door Car,639.105556 +TE34064,California,M,High School or Below,216852.35,0.0,63.0,0,Personal Auto,Four-Door Car,453.6 +WU60905,California,F,High School or Below,861066.75,0.0,111.0,0,Corporate Auto,SUV,532.8 +YM18992,California,F,College,283464.62,24506.0,71.0,0,Personal Auto,Two-Door Car,511.2 +PD55753,Oregon,M,High School or Below,893013.97,0.0,82.0,0,Personal Auto,Four-Door Car,554.522969 +KU56006,Arizona,F,College,553638.7,52220.0,70.0,1,Personal Auto,Four-Door Car,336.0 +MJ69973,Arizona,M,High School or Below,284085.43,0.0,74.0,0,Personal Auto,Two-Door Car,402.449823 +TW43626,California,M,College,808288.1,53554.0,67.0,0,Personal Auto,Four-Door Car,327.020539 +XX84133,California,M,Bachelor,525473.43,34476.0,67.0,1,Corporate Auto,Four-Door Car,5.3953 +ZW84453,Arizona,F,Bachelor,511623.76,0.0,70.0,0,Personal Auto,Four-Door Car,131.401291 +HO29524,California,M,College,303464.7,68205.0,76.0,0,Personal Auto,Two-Door Car,99.382943 +VE89726,California,F,High School or Below,802489.99,0.0,119.0,1,Personal Auto,SUV,856.8 +GE87503,California,M,High School or Below,1821114.32,53690.0,154.0,0,Personal Auto,SUV,739.2 +PX90263,Oregon,M,High School or Below,512156.33,0.0,72.0,0,Personal Auto,Four-Door Car,518.4 +NI17718,California,F,High School or Below,215017.86,0.0,61.0,0,Personal Auto,Four-Door Car,292.8 +FY32213,California,F,High School or Below,559538.99,74454.0,71.0,0,Personal Auto,Four-Door Car,340.8 +RZ13254,Nevada,F,Bachelor,756282.4,0.0,73.0,0,Personal Auto,Four-Door Car,350.4 +GN45013,Oregon,M,High School or Below,538585.32,29664.0,71.0,0,Personal Auto,Four-Door Car,340.8 +NM39588,Washington,F,Doctor,267805.83,72450.0,66.0,0,Corporate Auto,Four-Door Car,84.218363 +KU84464,Nevada,F,Bachelor,942256.79,47272.0,79.0,3,Personal Auto,Four-Door Car,64.546877 +YH43527,Oregon,F,College,360586.03,21585.0,92.0,0,Corporate Auto,Four-Door Car,441.6 +RO30676,California,F,College,776259.06,23827.0,106.0,2,Personal Auto,Four-Door Car,37.910623 +QL59704,Arizona,F,College,2344490.05,69906.0,74.0,2,Corporate Auto,Four-Door Car,202.860399 +QH19450,California,F,High School or Below,255817.82,0.0,72.0,0,Corporate Auto,Four-Door Car,345.6 +SA54664,Washington,M,Master,265438.1,73196.0,66.0,1,Personal Auto,Four-Door Car,85.809817 +CI38330,Washington,M,Bachelor,254978.61,72217.0,6464.0,0,Personal Auto,Four-Door Car,91.146661 +WB38524,California,M,High School or Below,296959.33,46131.0,74.0,0,Personal Auto,Two-Door Car,355.2 +CE56187,Oregon,F,Master,436312.46,54514.0,109.0,3,Personal Auto,SUV,286.234931 +JL19416,California,F,High School or Below,588430.86,0.0,161.0,0,Personal Auto,SUV,1159.2 +JZ61422,Nevada,F,College,527219.16,96668.0,66.0,0,Personal Auto,Four-Door Car,316.8 +LA13377,California,M,Doctor,550989.57,78879.0,69.0,1,Personal Auto,Four-Door Car,466.570791 +NC99948,Nevada,M,College,1631368.35,0.0,69.0,0,Personal Auto,Four-Door Car,331.2 +QD34785,Arizona,F,Bachelor,567805.02,0.0,76.0,0,Personal Auto,Four-Door Car,364.8 +RO26085,California,F,Bachelor,1210120.88,0.0,112.0,0,Personal Auto,Luxury,1252.406235 +ES57969,Oregon,M,Bachelor,245357.08,29735.0,69.0,0,Personal Auto,Four-Door Car,331.2 +JK55587,California,M,High School or Below,507566.27,23082.0,65.0,0,Special Auto,Four-Door Car,312.0 +RN97635,Arizona,M,Bachelor,321497.94,53984.0,80.0,0,Corporate Auto,Four-Door Car,421.484456 +BI76326,California,F,College,1227534.31,52135.0,156.0,0,Personal Auto,SUV,430.505942 +JA34909,California,F,College,272221.07,17576.0,71.0,0,Corporate Auto,Four-Door Car,398.502948 +OJ90342,Oregon,F,Bachelor,245744.09,29486.0,62.0,0,Personal Auto,Four-Door Car,7.646763 +CM88932,Oregon,F,Master,355484.53,58557.0,88.0,0,Corporate Auto,Four-Door Car,55.510526 +JJ97525,California,M,Bachelor,492954.97,25632.0,63.0,0,Personal Auto,Two-Door Car,351.270869 +XV21647,California,F,High School or Below,803645.03,0.0,112.0,0,Personal Auto,Luxury,806.4 +MC83487,Arizona,M,Bachelor,427691.53,18768.0,68.0,3,Corporate Auto,Four-Door Car,647.454583 +BL90769,California,F,Bachelor,3347334.95,33190.0,106.0,0,Personal Auto,SUV,508.8 +CR57148,Oregon,F,Master,596058.14,47945.0,74.0,0,Personal Auto,Two-Door Car,128.43823 +CP85232,Arizona,M,College,4479546.94,58778.0,126.0,0,Special Auto,SUV,302.033971 +YL74732,California,F,High School or Below,383211.81,15192.0,100.0,0,Personal Auto,SUV,480.0 +FG16766,California,F,Bachelor,683793.26,51859.0,171.0,0,Personal Auto,SUV,1003.160633 +NV55438,Nevada,F,High School or Below,528526.82,23422.0,72.0,0,Personal Auto,Two-Door Car,518.4 +RM10880,California,F,College,309651.12,21604.0,79.0,0,Corporate Auto,Four-Door Car,379.2 +GL56175,Arizona,M,College,358971.07,79298.0,90.0,0,Personal Auto,Four-Door Car,244.362072 +UK52289,Arizona,F,Bachelor,258240.85,76731.0,64.0,0,Special Auto,Four-Door Car,201.455005 +OT85112,Washington,M,College,340391.94,38460.0,88.0,1,Personal Auto,Four-Door Car,91.55098 +BC62782,Arizona,F,College,1357567.6,48534.0,115.0,1,Personal Auto,SUV,552.0 +TI19722,Washington,M,Doctor,343613.43,30817.0,88.0,0,Corporate Auto,Four-Door Car,91.834668 +JP30654,Oregon,F,College,2868582.79,48412.0,104.0,0,Personal Auto,SUV,707.430832 +UM45563,Washington,M,Bachelor,450267.97,68798.0,114.0,0,Personal Auto,SUV,92.915251 +EN60878,Oregon,M,Bachelor,618311.15,23712.0,85.0,0,Personal Auto,Four-Door Car,376.126419 +JF36291,California,M,College,387364.7,28142.0,105.0,0,Personal Auto,Luxury,701.708239 +BK59444,California,F,Master,1892933.06,72196.0,68.0,0,Personal Auto,Four-Door Car,152.184244 +MK70700,California,M,Master,555329.58,68197.0,69.0,0,Personal Auto,Four-Door Car,176.819414 +IW71076,California,M,Bachelor,501125.92,75248.0,63.0,0,Corporate Auto,Four-Door Car,104.454624 +AP98768,California,F,College,1044244.63,0.0,98.0,0,Personal Auto,Four-Door Car,941.718054 +OM24164,Nevada,M,Bachelor,219961.78,0.0,65.0,1,Personal Auto,Two-Door Car,468.0 +HR85211,Washington,F,Master,512317.09,89879.0,63.0,0,Personal Auto,Two-Door Car,94.030308 +VC87846,Oregon,M,High School or Below,748431.05,46998.0,96.0,0,Corporate Auto,Four-Door Car,460.8 +ZM92052,Oregon,M,Bachelor,261302.31,57099.0,67.0,0,Personal Auto,Two-Door Car,67.859881 +ON73702,Arizona,F,Bachelor,908063.97,33897.0,114.0,0,Corporate Auto,SUV,539.843003 +QQ90441,Nevada,F,High School or Below,1377097.62,59207.0,116.0,0,Personal Auto,Four-Door Car,556.8 +HU35721,Oregon,M,High School or Below,287682.29,40171.0,73.0,0,Personal Auto,Four-Door Car,350.4 +YP47665,Washington,M,Doctor,540891.15,80192.0,67.0,0,Personal Auto,Four-Door Car,95.193157 +FU99476,Washington,M,High School or Below,677030.68,74422.0,85.0,1,Personal Auto,Four-Door Car,95.338505 +AG85615,Oregon,M,College,2414387.56,0.0,87.0,0,Special Auto,Four-Door Car,626.4 +OY74069,Arizona,F,College,353805.95,0.0,67.0,5,Personal Auto,Four-Door Car,321.6 +DJ91267,Nevada,F,Bachelor,2909123.94,34226.0,244.0,0,Personal Auto,Luxury,494.395024 +KB72438,California,F,High School or Below,1983420.12,65989.0,123.0,1,Personal Auto,SUV,115.545086 +TR67616,Oregon,M,High School or Below,473136.7,30686.0,61.0,0,Corporate Auto,Four-Door Car,19.938981 +GF65731,California,F,Master,3553784.6,0.0,113.0,0,Personal Auto,Luxury,799.926741 +HB67642,Arizona,F,High School or Below,3461137.9,20090.0,109.0,0,Personal Auto,Luxury,523.2 +DP84567,California,M,High School or Below,2021630.88,0.0,183.0,0,Personal Auto,Luxury,878.4 +VV77534,Oregon,M,College,1397651.93,77094.0,176.0,0,Personal Auto,SUV,444.470676 +GL67540,California,F,College,590408.82,97413.0,73.0,0,Personal Auto,Four-Door Car,268.819985 +SV50502,Oregon,F,Master,559583.5,79189.0,69.0,0,Corporate Auto,Four-Door Car,331.2 +UK59698,California,F,High School or Below,229430.36,0.0,62.0,0,Personal Auto,Two-Door Car,297.6 +OA57352,Arizona,F,College,627391.19,18577.0,86.0,0,Personal Auto,Four-Door Car,412.8 +ZF84449,Oregon,F,College,372672.8,0.0,112.0,1,Special Auto,Luxury,806.4 +AX86150,Washington,M,High School or Below,265671.31,62777.0,67.0,0,Personal Auto,Two-Door Car,101.288069 +HG39060,Oregon,M,Bachelor,511068.08,0.0,74.0,0,Corporate Auto,Four-Door Car,532.8 +EM29359,Nevada,M,College,712659.65,17483.0,183.0,0,Personal Auto,Luxury,1317.6 +SF57173,Oregon,M,Master,460163.41,84394.0,114.0,0,Personal Auto,SUV,691.412378 +OT47603,Oregon,M,College,915523.97,0.0,127.0,0,Personal Auto,Luxury,804.811859 +SW31412,Oregon,F,College,1480805.62,41440.0,62.0,1,Personal Auto,Four-Door Car,297.6 +JS36322,Arizona,M,High School or Below,890167.84,0.0,136.0,1,Personal Auto,Luxury,1090.86434 +RE81445,Oregon,F,College,573459.82,98132.0,71.0,0,Personal Auto,Two-Door Car,50.587035 +RM24280,Oregon,F,High School or Below,417769.7,0.0,112.0,0,Personal Auto,Four-Door Car,537.6 +LC25393,California,M,Bachelor,2777628.91,88220.0,230.0,0,Personal Auto,Luxury,151.528482 +UX38930,Arizona,F,Master,1036434.75,58327.0,129.0,0,Personal Auto,SUV,347.075948 +HD95496,Oregon,M,Master,785190.14,25950.0,66.0,0,Personal Auto,Two-Door Car,271.697529 +RX24650,Oregon,M,High School or Below,477294.38,20993.0,133.0,0,Corporate Auto,SUV,638.4 +DW19309,Oregon,M,High School or Below,1422650.49,65726.0,177.0,0,Corporate Auto,SUV,849.6 +MT41386,Washington,M,Bachelor,287543.24,84768.0,72.0,0,Personal Auto,Two-Door Car,110.484661 +WZ40465,Washington,F,Bachelor,504129.96,36234.0,63.0,0,Personal Auto,Four-Door Car,113.534474 +DB42794,California,M,College,436293.12,58842.0,110.0,0,Personal Auto,Four-Door Car,528.0 +JB50798,Oregon,F,Master,962452.44,25629.0,124.0,2,Corporate Auto,Luxury,595.2 +IP69763,Washington,F,College,2191440.55,77311.0,181.0,0,Personal Auto,SUV,113.609508 +TE35785,California,M,Doctor,694842.22,0.0,196.0,2,Personal Auto,Luxury,1337.063487 +HX74855,Washington,M,High School or Below,247152.84,95697.0,61.0,0,Personal Auto,Two-Door Car,114.273025 +QN65180,Oregon,F,Bachelor,2190391.36,22254.0,79.0,0,Personal Auto,Four-Door Car,125.194389 +GE47180,Nevada,M,High School or Below,902882.14,65974.0,113.0,0,Personal Auto,Luxury,235.220971 +VQ38776,Oregon,F,College,530375.95,0.0,76.0,0,Personal Auto,Four-Door Car,395.34111 +BH86846,Washington,M,High School or Below,2070825.88,92079.0,65.0,1,Corporate Auto,Four-Door Car,114.798771 +IN17648,Nevada,M,High School or Below,512376.81,0.0,74.0,0,Personal Auto,Two-Door Car,772.798511 +DF95759,Oregon,M,College,949234.3,0.0,132.0,0,Personal Auto,SUV,633.6 +QG45324,Oregon,F,High School or Below,820486.32,0.0,73.0,0,Personal Auto,Four-Door Car,350.4 +MN61620,Arizona,F,College,987729.57,67752.0,131.0,4,Personal Auto,Luxury,168.517149 +YH86390,California,F,Bachelor,481500.97,25398.0,64.0,0,Corporate Auto,Four-Door Car,307.2 +FY13480,California,M,High School or Below,627701.17,0.0,88.0,0,Personal Auto,Four-Door Car,633.6 +YH61661,California,M,High School or Below,826063.98,33321.0,105.0,0,Special Auto,SUV,504.0 +NL93182,Nevada,M,Bachelor,254945.0,0.0,78.0,0,Corporate Auto,Four-Door Car,845.654042 +LN31673,Washington,Unknown,College,1131808.98,38923.0,99.0,2,Personal Auto,Four-Door Car,115.728852 +WE68644,Oregon,F,Bachelor,380392.18,20325.0,100.0,0,Personal Auto,Luxury,668.29397 +EZ30498,Oregon,M,Bachelor,863540.35,13129.0,117.0,0,Personal Auto,SUV,700.901632 +QY74517,Oregon,F,High School or Below,551055.9,0.0,73.0,0,Personal Auto,Four-Door Car,525.6 +NM88660,Nevada,M,Master,358588.41,49080.0,91.0,0,Corporate Auto,Four-Door Car,25.299 +MZ82036,Nevada,M,College,488925.28,42536.0,63.0,0,Personal Auto,Four-Door Car,375.330097 +ID20929,Oregon,M,Bachelor,275694.17,29926.0,74.0,0,Corporate Auto,Four-Door Car,418.233667 +EY50028,Nevada,M,Doctor,328954.74,0.0,86.0,0,Corporate Auto,Two-Door Car,398.240791 +TT82373,California,F,Bachelor,1093717.85,21450.0,138.0,0,Personal Auto,Luxury,938.513425 +OH64088,California,M,High School or Below,737556.79,33345.0,65.0,0,Corporate Auto,Four-Door Car,338.619869 +SK97780,California,F,Bachelor,1011077.82,15752.0,90.0,0,Corporate Auto,Two-Door Car,339.344531 +IO33050,Oregon,F,High School or Below,511941.43,40169.0,65.0,1,Personal Auto,Four-Door Car,302.818833 +XA55917,California,F,College,853383.2,26049.0,113.0,1,Personal Auto,SUV,619.165344 +JK32620,Nevada,M,College,222476.8,0.0,68.0,0,Personal Auto,Four-Door Car,326.4 +RQ19236,Arizona,M,Doctor,804280.38,55411.0,100.0,0,Personal Auto,Luxury,259.561195 +QC47433,Oregon,M,College,255443.71,12459.0,70.0,0,Personal Auto,Four-Door Car,336.0 +RA93608,Oregon,M,Bachelor,1807394.0,64620.0,76.0,1,Personal Auto,Two-Door Car,364.8 +XH97711,California,M,Bachelor,243050.66,83140.0,61.0,0,Corporate Auto,Four-Door Car,179.161843 +AU96286,Oregon,F,Bachelor,316765.84,0.0,92.0,0,Corporate Auto,Four-Door Car,662.4 +KC17170,Arizona,F,Bachelor,546560.4,54422.0,68.0,0,Corporate Auto,Four-Door Car,75.501852 +ZN47335,California,M,College,1035751.42,68309.0,131.0,0,Corporate Auto,SUV,306.983596 +EI46264,California,M,High School or Below,253781.39,56621.0,65.0,2,Personal Auto,Four-Door Car,84.026848 +EK87864,Arizona,F,College,282194.72,38977.0,70.0,0,Special Auto,Four-Door Car,139.489926 +GV45403,Arizona,M,Bachelor,775712.81,0.0,111.0,0,Corporate Auto,Two-Door Car,607.4459 +QK31192,Arizona,M,High School or Below,407913.27,0.0,114.0,0,Corporate Auto,Two-Door Car,631.124372 +LU89008,Arizona,F,College,595554.46,0.0,83.0,0,Personal Auto,Four-Door Car,628.023494 +NS10490,Oregon,F,Bachelor,1415861.36,83235.0,70.0,0,Personal Auto,Two-Door Car,336.0 +KL98495,Nevada,M,College,848723.8,0.0,74.0,0,Personal Auto,Two-Door Car,426.655599 +IU96845,Arizona,M,College,628547.69,32390.0,80.0,0,Personal Auto,Four-Door Car,91.417923 +QL93655,Oregon,F,High School or Below,1147348.15,66538.0,95.0,0,Personal Auto,Two-Door Car,317.844812 +PF40592,Washington,F,College,494263.06,23285.0,65.0,0,Personal Auto,Two-Door Car,118.446235 +LZ34046,Oregon,M,Bachelor,2359468.02,76358.0,66.0,0,Personal Auto,Four-Door Car,86.461582 +JC80093,Washington,M,Master,257250.66,21104.0,66.0,0,Personal Auto,Four-Door Car,118.454974 +YE88490,Arizona,F,College,538089.86,55350.0,67.0,0,Personal Auto,Four-Door Car,321.6 +YC80498,California,F,College,477055.09,12964.0,65.0,0,Personal Auto,Two-Door Car,362.774545 +AI85843,Arizona,F,Master,675665.14,33288.0,86.0,2,Personal Auto,Four-Door Car,221.856184 +XD66024,Arizona,F,College,593601.18,0.0,84.0,0,Personal Auto,Four-Door Car,980.169081 +FY51713,Arizona,F,Bachelor,357076.05,56168.0,88.0,0,Personal Auto,Four-Door Car,614.675906 +PH26378,California,M,College,601996.05,0.0,92.0,0,Personal Auto,Four-Door Car,662.4 +WQ18638,Oregon,M,High School or Below,542686.4,23105.0,69.0,0,Personal Auto,Two-Door Car,331.2 +KY14688,Oregon,F,Master,273031.38,36218.0,68.0,0,Personal Auto,Four-Door Car,145.252168 +TC97762,California,F,High School or Below,498268.14,52275.0,62.0,0,Corporate Auto,Four-Door Car,374.240783 +QC87108,Oregon,F,College,876926.68,49665.0,74.0,0,Personal Auto,Four-Door Car,355.2 +CX12134,Nevada,M,High School or Below,422061.35,32471.0,110.0,0,Personal Auto,Two-Door Car,528.0 +SM73248,Arizona,M,High School or Below,1153750.51,0.0,86.0,1,Corporate Auto,Two-Door Car,619.2 +CK19789,California,F,Master,588718.2,62773.0,73.0,0,Personal Auto,Four-Door Car,80.669257 +UV12583,California,F,College,470058.38,76694.0,117.0,0,Personal Auto,SUV,561.6 +JC11405,Oregon,M,High School or Below,1096395.72,55687.0,276.0,0,Personal Auto,Luxury,1324.8 +KA89683,Arizona,F,High School or Below,252317.12,0.0,70.0,0,Personal Auto,Four-Door Car,504.0 +BG85305,Nevada,M,Doctor,375780.47,36633.0,96.0,1,Personal Auto,Four-Door Car,460.8 +UQ87917,Oregon,M,High School or Below,1294173.35,77060.0,106.0,0,Personal Auto,SUV,468.566133 +XN11823,Nevada,F,Bachelor,376446.51,92600.0,94.0,0,Corporate Auto,Two-Door Car,842.43785 +OS46571,California,M,High School or Below,688955.7,0.0,66.0,0,Personal Auto,Four-Door Car,475.2 +PX17116,Nevada,M,College,362345.42,0.0,111.0,2,Corporate Auto,SUV,1171.93117 +RP19541,Arizona,M,College,758211.38,64801.0,64.0,0,Personal Auto,Four-Door Car,268.471802 +ZR25747,Oregon,F,College,827774.56,45257.0,103.0,0,Corporate Auto,Two-Door Car,494.4 +NQ86532,California,M,High School or Below,257645.56,26854.0,66.0,0,Personal Auto,Four-Door Car,475.2 +JY27336,Oregon,F,College,820538.79,85840.0,102.0,2,Corporate Auto,SUV,138.722385 +PB54378,Oregon,F,Doctor,1958246.89,26463.0,72.0,0,Corporate Auto,Four-Door Car,345.6 +SV38190,Nevada,F,Bachelor,648152.66,30689.0,81.0,0,Personal Auto,Four-Door Car,467.24802 +CV24005,Oregon,M,High School or Below,259931.09,29590.0,66.0,0,Corporate Auto,Two-Door Car,467.503236 +EX28656,Oregon,F,College,983033.76,25965.0,253.0,0,Personal Auto,Luxury,1214.4 +CF57022,Oregon,M,Bachelor,1044265.14,17269.0,139.0,0,Personal Auto,SUV,667.2 +GM16780,Oregon,M,College,3605753.7,90330.0,137.0,3,Corporate Auto,Luxury,192.085299 +BX94438,California,F,High School or Below,847003.68,0.0,113.0,0,Corporate Auto,SUV,619.973889 +RM41745,California,F,High School or Below,827878.65,0.0,110.0,0,Personal Auto,Four-Door Car,1002.782553 +XR70252,California,F,High School or Below,478893.26,0.0,67.0,1,Personal Auto,Two-Door Car,321.6 +YH92099,Arizona,F,Bachelor,308799.99,18558.0,80.0,0,Special Auto,Four-Door Car,384.0 +SG81493,Arizona,M,Bachelor,444373.62,46384.0,113.0,0,Corporate Auto,Four-Door Car,251.774574 +ZX23819,Oregon,F,High School or Below,798408.65,0.0,72.0,0,Personal Auto,Two-Door Car,866.208321 +FJ54907,Oregon,F,College,718097.1,42303.0,180.0,0,Personal Auto,Luxury,1210.920949 +CU26127,California,F,Bachelor,1565603.43,71731.0,130.0,0,Corporate Auto,SUV,599.648466 +YH60476,Oregon,M,High School or Below,578018.22,51066.0,74.0,0,Corporate Auto,Four-Door Car,787.993313 +ZZ97035,California,M,College,2071494.04,0.0,203.0,0,Corporate Auto,Luxury,2027.724442 +GE82737,Nevada,F,Bachelor,533735.24,0.0,86.0,3,Personal Auto,Four-Door Car,619.2 +KY21873,Arizona,M,College,505082.62,0.0,69.0,0,Personal Auto,Two-Door Car,72.852047 +UA51318,Arizona,F,High School or Below,511662.4,26173.0,68.0,1,Corporate Auto,Four-Door Car,449.819671 +BV55014,Oregon,M,Bachelor,726873.7,24445.0,63.0,0,Personal Auto,Two-Door Car,302.4 +HX21307,Oregon,M,College,261661.39,72302.0,66.0,0,Personal Auto,Two-Door Car,316.8 +LQ68252,Oregon,M,High School or Below,373843.62,27208.0,102.0,0,Personal Auto,SUV,489.6 +CR92802,California,F,Master,272535.64,36650.0,69.0,1,Special Auto,Four-Door Car,56.60333 +SL35268,Arizona,M,College,545386.12,30855.0,68.0,0,Corporate Auto,Four-Door Car,259.060862 +RD62882,Arizona,F,Bachelor,684615.03,0.0,95.0,0,Personal Auto,Two-Door Car,456.0 +JS42382,Oregon,M,Master,617291.42,99960.0,76.0,0,Corporate Auto,Four-Door Car,364.8 +BT30554,Arizona,F,Bachelor,1034632.45,0.0,98.0,0,Personal Auto,Four-Door Car,470.4 +VP57424,Nevada,F,Bachelor,699700.86,55873.0,88.0,0,Personal Auto,Four-Door Car,299.356083 +VU19243,Arizona,F,High School or Below,419625.77,18052.0,111.0,0,Personal Auto,Four-Door Car,699.1679 +TA82973,Oregon,F,High School or Below,785810.98,28937.0,104.0,2,Personal Auto,SUV,117.959654 +GK71720,Oregon,F,High School or Below,606434.4,0.0,86.0,0,Personal Auto,Four-Door Car,545.240341 +OQ61223,California,M,College,1749752.2,0.0,73.0,0,Personal Auto,Two-Door Car,350.4 +LL62746,Oregon,M,Doctor,897064.73,12829.0,118.0,0,Personal Auto,SUV,328.231432 +JQ56711,Oregon,F,Master,592311.72,92163.0,73.0,0,Personal Auto,Two-Door Car,66.568642 +AW77988,Oregon,M,High School or Below,3585059.94,17588.0,192.0,0,Personal Auto,Luxury,1382.4 +QP84605,Washington,F,Bachelor,870984.53,41546.0,111.0,0,Corporate Auto,Four-Door Car,121.306839 +MY97912,Arizona,M,College,1330933.52,0.0,127.0,0,Personal Auto,SUV,609.6 +IB87349,California,M,High School or Below,452850.49,70340.0,113.0,0,Special Auto,Four-Door Car,542.4 +AW73065,Oregon,F,High School or Below,279190.65,0.0,74.0,0,Personal Auto,Four-Door Car,532.8 +BW80872,Washington,M,High School or Below,443441.12,34549.0,111.0,0,Personal Auto,Four-Door Car,125.933005 +PX70175,Arizona,M,College,799600.75,93459.0,99.0,0,Personal Auto,Four-Door Car,655.41333 +KF75098,Arizona,M,Bachelor,512973.9,86148.0,65.0,2,Personal Auto,Four-Door Car,312.0 +IS50283,California,F,Bachelor,569717.52,27048.0,72.0,0,Corporate Auto,Four-Door Car,345.6 +MY64920,Oregon,F,College,921713.06,73259.0,115.0,0,Personal Auto,SUV,673.34265 +KN34250,Oregon,F,College,1020892.76,35482.0,129.0,0,Corporate Auto,SUV,619.2 +GN46207,Oregon,F,Master,417068.73,29462.0,107.0,1,Personal Auto,SUV,513.6 +KL57176,Oregon,F,College,450540.58,67801.0,115.0,1,Personal Auto,SUV,23.810491 +MN94234,California,M,High School or Below,310756.86,0.0,94.0,4,Personal Auto,Two-Door Car,451.2 +JY90595,Arizona,M,High School or Below,552866.5,16042.0,73.0,0,Personal Auto,Two-Door Car,350.4 +HK26543,California,M,High School or Below,504586.67,28056.0,64.0,1,Personal Auto,Four-Door Car,307.2 +PN86062,California,M,High School or Below,296272.25,16495.0,85.0,3,Corporate Auto,Four-Door Car,408.0 +VW27730,California,F,Master,866595.64,41163.0,108.0,0,Corporate Auto,SUV,231.922173 +SH55671,Arizona,F,College,1141344.12,0.0,161.0,1,Personal Auto,Luxury,772.8 +MO56878,California,M,Bachelor,1548843.2,33799.0,109.0,3,Corporate Auto,SUV,664.980242 +VO38365,Washington,F,College,886114.95,90125.0,110.0,0,Corporate Auto,SUV,128.645946 +SV35618,Oregon,F,Bachelor,593474.15,87747.0,147.0,1,Personal Auto,SUV,46.492039 +RX12347,Nevada,M,College,354323.21,35695.0,90.0,0,Personal Auto,Four-Door Car,432.0 +FR55658,California,M,Master,349002.83,90985.0,87.0,0,Personal Auto,Four-Door Car,78.085149 +XS12556,California,F,College,368309.99,0.0,101.0,0,Corporate Auto,Luxury,564.466556 +ZU73588,California,M,College,598977.39,66839.0,154.0,0,Personal Auto,Luxury,739.2 +WT43034,California,F,High School or Below,1250084.3,0.0,165.0,0,Personal Auto,SUV,792.0 +VM13430,Oregon,F,Bachelor,860915.82,79090.0,107.0,0,Corporate Auto,SUV,289.040734 +TC78849,Oregon,M,Bachelor,249745.51,24825.0,64.0,0,Personal Auto,Two-Door Car,155.938593 +VC34764,California,M,College,701917.72,26806.0,63.0,0,Personal Auto,Four-Door Car,302.4 +WO90953,Oregon,F,College,538792.63,56835.0,67.0,0,Personal Auto,Two-Door Car,326.549425 +IU47468,Oregon,F,Bachelor,616555.75,0.0,88.0,0,Special Auto,Two-Door Car,653.65668 +KO46064,California,M,Bachelor,273020.29,46135.0,69.0,0,Personal Auto,Four-Door Car,103.935601 +RB34917,Arizona,F,Bachelor,516211.69,0.0,73.0,0,Personal Auto,Four-Door Car,809.532341 +BI38192,Oregon,F,High School or Below,793706.48,22862.0,67.0,0,Personal Auto,Two-Door Car,321.6 +PU18983,Oregon,F,High School or Below,860815.72,21450.0,110.0,2,Personal Auto,Luxury,528.0 +SW79912,Oregon,M,Bachelor,263254.58,95854.0,65.0,0,Personal Auto,Two-Door Car,312.0 +ES39217,Oregon,F,Bachelor,778500.42,44897.0,99.0,1,Personal Auto,Four-Door Car,580.72531 +KP72427,Washington,M,High School or Below,2163983.86,64455.0,108.0,0,Personal Auto,SUV,133.735395 +UA19178,Oregon,F,Master,498082.5,53265.0,62.0,0,Personal Auto,Four-Door Car,238.005074 +PR53785,Arizona,F,High School or Below,745723.78,0.0,198.0,1,Personal Auto,Luxury,1577.674417 +XF57481,Washington,M,Master,1064093.93,50450.0,90.0,0,Personal Auto,Two-Door Car,135.892444 +CN90378,California,F,High School or Below,686250.83,54780.0,88.0,3,Personal Auto,Four-Door Car,135.26125 +KI56154,Nevada,M,High School or Below,904898.34,0.0,119.0,0,Personal Auto,Luxury,571.2 +UI55951,California,M,Bachelor,554803.19,67798.0,69.0,0,Personal Auto,Four-Door Car,331.2 +FF28650,Oregon,M,Bachelor,831268.16,21442.0,118.0,0,Personal Auto,SUV,566.4 +FS55302,California,M,Bachelor,238998.1,27615.0,62.0,1,Personal Auto,Four-Door Car,297.6 +TN79487,California,M,Bachelor,445811.34,17622.0,65.0,1,Personal Auto,Four-Door Car,312.0 +HG32616,Nevada,M,High School or Below,529574.17,50200.0,135.0,0,Personal Auto,Luxury,637.063458 +UK41984,Arizona,F,Doctor,383960.61,0.0,112.0,2,Personal Auto,SUV,537.6 +LZ52266,California,F,High School or Below,373150.46,0.0,96.0,0,Personal Auto,Four-Door Car,460.8 +PM27367,California,F,Master,277890.37,73570.0,70.0,1,Special Auto,Two-Door Car,75.936096 +ZK21724,Oregon,F,High School or Below,401654.2,0.0,111.0,0,Personal Auto,SUV,799.2 +BH35482,Washington,M,Doctor,493094.93,70412.0,61.0,0,Corporate Auto,Two-Door Car,136.291083 +QE22757,Nevada,M,Doctor,249131.7,36631.0,62.0,0,Personal Auto,Four-Door Car,67.530904 +ON77649,Oregon,F,College,290887.59,35895.0,73.0,0,Personal Auto,Four-Door Car,312.921256 +RN82884,Arizona,F,College,428294.8,40864.0,109.0,1,Personal Auto,SUV,166.937747 +CQ75652,Oregon,M,College,834162.37,0.0,118.0,0,Personal Auto,Four-Door Car,566.4 +FF58467,Arizona,F,Master,509078.13,93018.0,63.0,0,Personal Auto,Four-Door Car,135.382194 +BS83666,Oregon,M,Bachelor,736618.83,70014.0,62.0,0,Corporate Auto,Four-Door Car,17.742954 +WO29605,Oregon,F,College,243687.51,48875.0,61.0,0,Personal Auto,Two-Door Car,1.838367 +TL77607,California,M,Bachelor,885268.87,67969.0,74.0,0,Personal Auto,Four-Door Car,197.776009 +EZ50606,Oregon,F,High School or Below,2387547.68,0.0,108.0,0,Corporate Auto,SUV,612.102262 +OS39723,Oregon,F,Doctor,560049.65,68665.0,69.0,0,Personal Auto,Two-Door Car,331.2 +FN69743,California,M,College,463654.65,26802.0,66.0,1,Corporate Auto,Two-Door Car,316.8 +XW96958,Nevada,M,High School or Below,757334.51,0.0,110.0,0,Corporate Auto,Four-Door Car,1193.036154 +TU92578,California,M,College,1469663.55,45345.0,125.0,0,Personal Auto,SUV,600.0 +TL43709,Washington,M,Bachelor,897214.03,89689.0,74.0,0,Personal Auto,Four-Door Car,136.829537 +YE68736,California,F,Bachelor,772484.01,32051.0,193.0,1,Personal Auto,SUV,926.4 +OB96537,Oregon,M,Master,594667.07,81139.0,74.0,0,Special Auto,Four-Door Car,392.6364 +EU68825,Oregon,F,Master,800054.51,63834.0,100.0,1,Personal Auto,Luxury,215.226476 +CC31456,Arizona,M,Bachelor,645756.1,37548.0,81.0,0,Special Auto,Four-Door Car,160.598662 +DJ77787,Arizona,F,High School or Below,728144.01,0.0,69.0,3,Personal Auto,Four-Door Car,371.803029 +LN26837,California,M,High School or Below,259243.78,72421.0,65.0,0,Personal Auto,Four-Door Car,312.0 +YI92916,Nevada,M,Master,467842.34,83102.0,116.0,0,Corporate Auto,Four-Door Car,443.670399 +NW54906,Oregon,M,College,1386992.71,28432.0,118.0,0,Personal Auto,SUV,612.300581 +ME77513,Nevada,F,Master,871777.78,83707.0,108.0,0,Corporate Auto,Four-Door Car,290.391526 +UK76891,California,F,College,523398.68,63259.0,65.0,0,Corporate Auto,Four-Door Car,316.795337 +SI26888,Nevada,F,High School or Below,476418.97,0.0,67.0,0,Personal Auto,Four-Door Car,405.527937 +YD74948,Oregon,F,College,247246.92,63860.0,62.0,0,Personal Auto,Four-Door Car,208.598246 +HB64268,Washington,M,Bachelor,281369.26,43836.0,73.0,0,Personal Auto,Four-Door Car,138.130879 +BW52697,California,F,College,550505.7,86132.0,68.0,0,Personal Auto,Two-Door Car,301.437365 +NL41409,Oregon,F,Bachelor,260620.85,28519.0,66.0,0,Personal Auto,Two-Door Car,456.473115 +OD69005,Arizona,F,High School or Below,1048194.38,39102.0,88.0,0,Personal Auto,Four-Door Car,152.338562 +ZZ91716,California,F,Bachelor,325676.64,0.0,89.0,0,Personal Auto,Four-Door Car,491.755368 +UK70255,California,F,College,3047578.05,97298.0,128.0,0,Personal Auto,Luxury,48.517439 +QT25383,Nevada,M,High School or Below,636490.22,41986.0,84.0,2,Personal Auto,Two-Door Car,430.375049 +AW18068,Arizona,M,High School or Below,946850.93,0.0,88.0,0,Personal Auto,Two-Door Car,633.6 +NS45347,Oregon,F,College,563145.19,17291.0,73.0,0,Personal Auto,Four-Door Car,350.4 +FV19421,California,M,Bachelor,778099.93,0.0,74.0,0,Personal Auto,Four-Door Car,246.489123 +XW89091,California,M,College,981652.83,37256.0,62.0,0,Personal Auto,Four-Door Car,128.969729 +YC11951,Oregon,M,High School or Below,751913.36,96306.0,95.0,1,Corporate Auto,Four-Door Car,185.355353 +UY18770,California,F,Bachelor,1017971.7,14290.0,271.0,0,Personal Auto,Luxury,1300.8 +RA49085,California,F,College,277283.92,37038.0,71.0,1,Corporate Auto,Four-Door Car,9.071305 +BG84194,Oregon,M,College,403750.18,90760.0,103.0,2,Special Auto,SUV,133.475315 +PT64580,Washington,M,Master,419196.61,77048.0,103.0,0,Personal Auto,SUV,141.199465 +MR67738,Oregon,F,High School or Below,267686.79,54480.0,67.0,0,Personal Auto,Four-Door Car,321.6 +DM95829,California,M,College,252395.96,16244.0,68.0,0,Personal Auto,Two-Door Car,623.223617 +DB75522,California,F,College,698840.16,22436.0,89.0,0,Special Auto,Four-Door Car,427.2 +LM34525,Washington,F,College,874205.78,71592.0,72.0,0,Personal Auto,Four-Door Car,141.725051 +WW30771,Arizona,M,Master,267331.96,28728.0,67.0,0,Personal Auto,Four-Door Car,321.6 +QP65569,Arizona,M,High School or Below,1215732.99,57449.0,103.0,0,Personal Auto,Four-Door Car,494.4 +TN50051,California,F,Doctor,295776.4,83318.0,73.0,0,Personal Auto,Two-Door Car,211.336937 +UO86707,Washington,M,Bachelor,717390.94,75217.0,61.0,1,Personal Auto,Four-Door Car,147.080303 +JA41698,Nevada,M,Bachelor,309953.8,0.0,102.0,5,Corporate Auto,SUV,862.762957 +NX18774,Oregon,M,Bachelor,841568.46,55308.0,107.0,0,Corporate Auto,SUV,513.6 +DA69469,Oregon,F,College,2684312.45,36068.0,97.0,0,Personal Auto,Two-Door Car,113.367765 +CN23147,Oregon,M,Bachelor,1305717.07,48804.0,112.0,1,Corporate Auto,Four-Door Car,537.6 +RA68844,Oregon,M,College,959995.02,0.0,131.0,0,Personal Auto,SUV,943.2 +GH42026,Oregon,M,Bachelor,853510.89,55790.0,111.0,0,Personal Auto,SUV,117.672722 +BD16530,Arizona,F,Bachelor,829348.19,70258.0,69.0,0,Personal Auto,Four-Door Car,225.145949 +JH91579,Oregon,F,Bachelor,684615.03,0.0,95.0,0,Personal Auto,Two-Door Car,456.0 +WK23685,Oregon,F,Bachelor,663685.98,47274.0,83.0,1,Corporate Auto,Four-Door Car,182.432565 +GR62267,Washington,F,College,560908.25,44705.0,71.0,0,Personal Auto,Two-Door Car,148.173152 +PI78084,Arizona,M,High School or Below,507732.09,0.0,73.0,0,Personal Auto,Two-Door Car,525.6 +GF97874,Washington,F,Master,527562.7,70446.0,65.0,0,Personal Auto,Four-Door Car,155.570802 +ZH19885,Washington,F,High School or Below,251459.2,43860.0,65.0,0,Personal Auto,Four-Door Car,156.124914 +UK25655,Oregon,F,Bachelor,343525.01,64348.0,86.0,0,Personal Auto,Two-Door Car,212.391975 +QR45101,Oregon,M,Bachelor,662461.18,0.0,62.0,0,Corporate Auto,Two-Door Car,297.6 +EL93539,California,M,Master,575744.23,88997.0,72.0,0,Special Auto,Four-Door Car,174.041566 +EE99484,Washington,F,High School or Below,251459.2,43860.0,65.0,0,Corporate Auto,Four-Door Car,156.124914 +DP46882,California,F,High School or Below,288645.16,10312.0,78.0,0,Corporate Auto,Four-Door Car,486.278557 +WP41146,California,F,High School or Below,534143.88,0.0,72.0,1,Personal Auto,Four-Door Car,345.6 +TK60799,Arizona,F,High School or Below,416001.81,96263.0,103.0,0,Personal Auto,SUV,1.924709 +DN29808,California,F,College,284624.54,28919.0,72.0,0,Corporate Auto,Four-Door Car,518.4 +SS59521,Oregon,F,College,477025.66,0.0,68.0,1,Personal Auto,Two-Door Car,326.4 +NG66579,Oregon,M,Bachelor,505961.62,41869.0,64.0,0,Personal Auto,Two-Door Car,262.12205 +TC14209,Arizona,F,High School or Below,909574.46,0.0,128.0,0,Personal Auto,SUV,921.6 +ED50963,California,F,High School or Below,268886.4,32808.0,68.0,1,Personal Auto,Four-Door Car,541.695658 +GP40701,California,F,Bachelor,827763.76,79780.0,68.0,0,Personal Auto,Four-Door Car,326.4 +CP98451,Oregon,F,College,905793.53,91025.0,112.0,0,Personal Auto,SUV,327.682669 +NX52648,California,F,High School or Below,380175.04,33043.0,95.0,0,Personal Auto,Two-Door Car,456.0 +ZC32510,Arizona,M,High School or Below,933934.16,69442.0,118.0,3,Personal Auto,Four-Door Car,1265.570302 +NG27780,Oregon,M,College,252012.32,0.0,70.0,0,Corporate Auto,Four-Door Car,63.043197 +HN95240,Arizona,F,College,498409.53,0.0,70.0,0,Corporate Auto,Four-Door Car,336.0 +EB59129,Oregon,F,Bachelor,259574.8,47234.0,65.0,0,Personal Auto,Four-Door Car,15.631363 +RA70851,Oregon,M,High School or Below,743769.33,86863.0,92.0,0,Personal Auto,Four-Door Car,441.6 +PM19162,Oregon,M,Bachelor,1453678.76,25805.0,66.0,2,Personal Auto,Four-Door Car,375.866091 +MS59005,Nevada,M,Bachelor,591330.59,43676.0,76.0,0,Personal Auto,Four-Door Car,364.8 +SU71163,Arizona,M,College,277166.3,59855.0,74.0,4,Personal Auto,Two-Door Car,355.2 +BD35676,Arizona,M,Master,2919436.64,35296.0,126.0,0,Personal Auto,SUV,452.616872 +NI44621,Oregon,F,Master,988038.58,36576.0,125.0,1,Personal Auto,SUV,113.450122 +EW33419,California,F,High School or Below,1511440.24,28513.0,100.0,1,Corporate Auto,SUV,480.0 +HX44948,Oregon,M,Bachelor,575991.08,85448.0,72.0,0,Special Auto,Four-Door Car,16.03451 +DL36983,Oregon,F,High School or Below,849516.42,23791.0,110.0,3,Personal Auto,Two-Door Car,615.27228 +XR87264,California,F,Bachelor,438118.42,20597.0,112.0,0,Personal Auto,Four-Door Car,615.256301 +NN99001,Arizona,F,College,699782.74,56940.0,87.0,0,Personal Auto,Four-Door Car,512.66245 +XV95530,Oregon,M,Bachelor,1143058.85,93210.0,71.0,0,Personal Auto,Two-Door Car,74.523935 +OL97871,Oregon,F,Bachelor,748248.61,48992.0,94.0,1,Personal Auto,Four-Door Car,426.072946 +HQ23708,Arizona,F,Master,859691.66,53736.0,71.0,0,Personal Auto,Two-Door Car,169.287785 +WR63188,Arizona,M,College,785496.08,25378.0,66.0,1,Personal Auto,Four-Door Car,419.464143 +NG82219,Oregon,F,Bachelor,258240.85,76731.0,64.0,0,Personal Auto,Four-Door Car,201.455005 +KU29408,Washington,M,Master,907576.82,37722.0,116.0,0,Corporate Auto,Luxury,158.077504 +RE46783,California,F,Bachelor,411858.86,69379.0,103.0,0,Personal Auto,Two-Door Car,494.4 +RU94434,Oregon,M,High School or Below,1215732.99,57449.0,103.0,0,Personal Auto,Four-Door Car,494.4 +GI82355,Arizona,M,Bachelor,515281.96,0.0,68.0,0,Corporate Auto,Four-Door Car,326.4 +VO26340,Nevada,M,College,651297.65,0.0,93.0,0,Personal Auto,Two-Door Car,669.6 +NV61299,Arizona,F,Bachelor,2778969.24,33806.0,89.0,0,Corporate Auto,Four-Door Car,395.729716 +DX31066,Washington,F,College,266727.0,94041.0,66.0,0,Personal Auto,Four-Door Car,159.756733 +CY50337,Oregon,F,College,1092840.71,74965.0,90.0,0,Personal Auto,Four-Door Car,58.557552 +TJ20375,Arizona,F,High School or Below,761538.13,34095.0,63.0,0,Personal Auto,Two-Door Car,302.4 +EP72155,California,F,College,200435.07,0.0,66.0,4,Personal Auto,Four-Door Car,316.8 +JJ76159,California,M,College,243468.12,96045.0,61.0,0,Corporate Auto,Four-Door Car,8.582971 +BG15419,Nevada,F,Bachelor,1419536.03,86355.0,118.0,0,Personal Auto,Luxury,285.418473 +AO74776,California,F,High School or Below,942768.49,27824.0,118.0,0,Personal Auto,SUV,566.4 +HQ82233,California,M,High School or Below,1198242.09,42995.0,101.0,0,Personal Auto,SUV,410.508316 +OL72737,Oregon,F,High School or Below,310278.95,21235.0,79.0,0,Personal Auto,Two-Door Car,244.23135 +ZQ59828,California,M,High School or Below,422263.12,74585.0,106.0,0,Personal Auto,SUV,218.598065 +NZ15548,Oregon,M,Bachelor,402381.44,41833.0,103.0,0,Personal Auto,Four-Door Car,643.826716 +XK61304,California,F,College,529715.18,23908.0,70.0,0,Personal Auto,Four-Door Car,336.0 +EJ44139,Oregon,M,Bachelor,2142363.72,0.0,65.0,0,Personal Auto,Two-Door Car,312.0 +CM94425,Arizona,M,Bachelor,441620.62,61953.0,113.0,0,Personal Auto,SUV,497.047297 +OV54878,California,M,Bachelor,463903.52,0.0,142.0,0,Corporate Auto,SUV,1022.4 +JF57282,Nevada,M,Bachelor,486354.46,0.0,137.0,0,Personal Auto,SUV,657.6 +MY37953,Arizona,F,Bachelor,2583090.98,73760.0,107.0,1,Personal Auto,Luxury,230.245772 +XP64922,Oregon,F,College,297431.49,23333.0,74.0,0,Corporate Auto,Four-Door Car,5.622751 +WL65572,California,M,College,206445.88,0.0,61.0,0,Personal Auto,Four-Door Car,292.8 +LN50325,Arizona,F,High School or Below,1006460.83,20440.0,128.0,2,Corporate Auto,Luxury,614.4 +HJ15383,Washington,M,Master,803240.19,27658.0,68.0,0,Personal Auto,Four-Door Car,160.07526 +KH59823,California,M,College,548921.41,50943.0,139.0,0,Special Auto,SUV,667.2 +YM79169,California,M,Bachelor,261275.67,19003.0,71.0,0,Personal Auto,Two-Door Car,34.651305 +DR38127,California,M,College,857346.39,46703.0,108.0,0,Personal Auto,Four-Door Car,678.100487 +PU42145,California,M,Bachelor,2412750.4,14072.0,71.0,0,Personal Auto,Four-Door Car,511.2 +KM33477,Oregon,M,College,855038.66,21733.0,73.0,0,Corporate Auto,Four-Door Car,525.6 +RI53167,Arizona,M,Bachelor,230864.8,20811.0,61.0,0,Personal Auto,Four-Door Car,292.8 +OF77789,Arizona,F,High School or Below,425462.07,11904.0,61.0,2,Personal Auto,Two-Door Car,292.8 +YB33445,Oregon,F,College,898285.04,43490.0,114.0,4,Corporate Auto,SUV,174.588413 +BA17836,California,M,High School or Below,786816.6,57340.0,67.0,0,Corporate Auto,Four-Door Car,159.391681 +JS43228,California,M,College,770424.87,49088.0,97.0,0,Corporate Auto,Four-Door Car,698.4 +BB11622,Nevada,M,Master,1055217.0,47761.0,131.0,0,Personal Auto,SUV,232.711071 +HQ70429,Washington,F,College,1604510.95,0.0,65.0,0,Personal Auto,Two-Door Car,163.046956 +WK88044,Arizona,M,Bachelor,873783.75,61281.0,110.0,0,Personal Auto,SUV,79.865605 +LA80525,Nevada,M,Bachelor,545489.07,0.0,82.0,1,Corporate Auto,Two-Door Car,393.6 +EH16250,Arizona,M,Bachelor,770528.33,25290.0,66.0,0,Personal Auto,Four-Door Car,382.085897 +PU41872,Arizona,F,High School or Below,703926.24,24239.0,88.0,0,Personal Auto,Four-Door Car,48.348319 +HB85743,California,M,Bachelor,883808.56,82664.0,114.0,3,Personal Auto,SUV,133.425609 +MM71959,Arizona,M,Bachelor,873352.73,83210.0,110.0,0,Personal Auto,Luxury,528.0 +MB83663,Oregon,F,Bachelor,959747.48,38736.0,81.0,0,Personal Auto,Two-Door Car,561.414794 +KR43119,California,M,College,450666.02,0.0,66.0,0,Personal Auto,Four-Door Car,316.8 +KH24214,Oregon,M,College,1785797.23,55437.0,64.0,1,Personal Auto,Four-Door Car,445.287788 +AC40767,Washington,M,Bachelor,249780.82,68041.0,6464.0,0,Personal Auto,Two-Door Car,165.570243 +HP55391,Oregon,M,Master,542613.62,0.0,71.0,0,Corporate Auto,Four-Door Car,407.99684 +EG62398,California,F,High School or Below,799814.38,29066.0,100.0,0,Personal Auto,SUV,844.229478 +VS19949,Nevada,M,Bachelor,289762.07,54337.0,72.0,0,Personal Auto,Four-Door Car,345.6 +AM92343,Oregon,F,High School or Below,1159950.22,67616.0,96.0,0,Personal Auto,Four-Door Car,340.306584 +GI68556,California,F,Bachelor,1514793.06,41082.0,63.0,0,Personal Auto,Two-Door Car,106.647493 +JT11876,Washington,F,High School or Below,543576.78,0.0,10202.0,0,Personal Auto,Four-Door Car,626.116259 +XR64251,Nevada,F,Master,272535.64,36650.0,69.0,1,Personal Auto,Four-Door Car,56.60333 +MK34957,Oregon,F,College,1329771.23,50631.0,112.0,4,Special Auto,SUV,784.65781 +GP18756,California,M,College,992704.97,19592.0,92.0,0,Personal Auto,Four-Door Car,441.6 +AP23850,Washington,F,High School or Below,1777154.9,0.0,114.0,0,Personal Auto,Two-Door Car,547.2 +KQ65521,Arizona,F,College,1826927.02,55761.0,115.0,0,Personal Auto,Luxury,86.27772 +EJ19449,California,F,College,272221.07,17576.0,71.0,0,Special Auto,Four-Door Car,398.502948 +QB70027,California,F,Bachelor,708321.24,41449.0,89.0,0,Personal Auto,Four-Door Car,63.516572 +QW47320,California,F,Bachelor,1017971.7,14290.0,271.0,0,Personal Auto,Luxury,1300.8 +KH64733,Nevada,F,College,588950.91,62007.0,73.0,0,Personal Auto,Four-Door Car,120.015609 +ON59472,Arizona,M,High School or Below,1577139.34,21921.0,206.0,0,Corporate Auto,Luxury,1254.137899 +HP94242,Arizona,F,Bachelor,528817.33,42621.0,66.0,0,Personal Auto,Four-Door Car,316.8 +RV15398,Oregon,M,College,2758055.4,0.0,87.0,1,Personal Auto,Four-Door Car,417.6 +EA25683,Washington,M,High School or Below,777853.23,63786.0,196.0,0,Corporate Auto,Luxury,798.002689 +PW73754,California,F,High School or Below,734186.13,0.0,104.0,3,Personal Auto,Luxury,82.041684 +MC71942,California,F,High School or Below,791919.7,82877.0,99.0,1,Personal Auto,Two-Door Car,22.819088 +OX72195,Arizona,M,College,216387.02,0.0,63.0,0,Corporate Auto,Two-Door Car,302.4 +YQ99152,Nevada,M,High School or Below,978780.88,10475.0,88.0,1,Personal Auto,Two-Door Car,422.4 +KI19439,Oregon,F,High School or Below,520764.08,21952.0,66.0,0,Personal Auto,Four-Door Car,316.8 +PM76175,Oregon,F,Bachelor,2114727.72,49721.0,132.0,0,Corporate Auto,Luxury,639.971388 +US45383,California,M,College,1228076.66,88340.0,102.0,0,Personal Auto,Two-Door Car,489.6 +GT38956,California,F,College,244139.42,0.0,65.0,0,Personal Auto,Four-Door Car,312.0 +SN41301,Oregon,M,Bachelor,653556.06,0.0,65.0,0,Corporate Auto,Four-Door Car,468.0 +BE62503,Washington,F,College,920659.83,24589.0,82.0,0,Personal Auto,Two-Door Car,511.497882 +PA16884,California,F,Bachelor,411858.86,69379.0,103.0,0,Personal Auto,Two-Door Car,494.4 +NC58480,Nevada,F,Bachelor,483820.9,73769.0,61.0,2,Personal Auto,Four-Door Car,239.540223 +NS39326,California,F,College,462554.81,66670.0,114.0,0,Personal Auto,SUV,518.180364 +PN18507,Arizona,M,Bachelor,1404210.3,88854.0,118.0,0,Personal Auto,Two-Door Car,715.252366 +EK91340,Oregon,M,Bachelor,754661.35,31266.0,193.0,0,Corporate Auto,Luxury,926.4 +JY16280,California,F,High School or Below,251459.2,43860.0,65.0,0,Personal Auto,Four-Door Car,156.124914 +ZW71731,California,M,Bachelor,517035.84,89284.0,133.0,2,Corporate Auto,SUV,402.070719 +ZC24631,Oregon,M,College,1391737.72,67267.0,89.0,0,Corporate Auto,Four-Door Car,94.814032 +YR34689,California,F,High School or Below,1131813.08,79270.0,95.0,3,Personal Auto,Four-Door Car,456.0 +RT65829,Oregon,M,Bachelor,427636.36,36692.0,109.0,1,Personal Auto,Four-Door Car,523.2 +BZ12077,Oregon,F,High School or Below,432224.03,0.0,119.0,0,Personal Auto,SUV,571.2 +WM65373,California,F,College,800230.83,0.0,107.0,0,Corporate Auto,SUV,513.6 +NH35059,Nevada,M,College,388545.64,0.0,105.0,0,Corporate Auto,Four-Door Car,504.0 +QD38160,Oregon,M,College,447177.82,0.0,135.0,0,Personal Auto,SUV,972.0 +BM15160,California,F,High School or Below,849635.28,44624.0,71.0,1,Special Auto,Four-Door Car,73.883044 +VY79030,Arizona,F,College,2250088.35,0.0,71.0,0,Corporate Auto,Four-Door Car,340.8 +EV19512,Nevada,F,Master,1630196.76,19614.0,85.0,0,Personal Auto,Two-Door Car,574.024018 +TE13577,Oregon,F,College,231973.59,0.0,64.0,0,Personal Auto,Four-Door Car,632.715382 +WY97929,Arizona,M,College,871704.98,83846.0,74.0,3,Special Auto,Four-Door Car,355.2 +YG20683,Washington,M,College,286011.17,51159.0,72.0,0,Personal Auto,Four-Door Car,4.238626 +FK75497,California,M,College,245340.83,83772.0,62.0,0,Personal Auto,Two-Door Car,42.248087 +NE60110,Arizona,M,College,598977.39,66839.0,154.0,0,Personal Auto,Luxury,739.2 +TN36521,Arizona,F,College,2498022.55,88440.0,70.0,0,Personal Auto,Two-Door Car,27.145151 +HG33568,Arizona,F,Master,748263.95,25666.0,63.0,2,Personal Auto,Four-Door Car,270.002766 +TW17878,Oregon,F,High School or Below,245757.6,52926.0,61.0,0,Personal Auto,Four-Door Car,292.8 +ZO83562,Nevada,F,Bachelor,237974.12,0.0,67.0,0,Personal Auto,Four-Door Car,494.946438 +CH97539,Washington,F,Bachelor,828696.44,40001.0,70.0,0,Personal Auto,Four-Door Car,142.567008 +CV29889,California,M,College,239391.54,0.0,70.0,0,Personal Auto,Four-Door Car,425.266308 +MO33320,Oregon,M,College,465715.95,18024.0,65.0,0,Personal Auto,Two-Door Car,312.0 +QZ81258,Oregon,F,College,1319792.89,0.0,68.0,3,Personal Auto,Four-Door Car,326.4 +NY56352,Oregon,F,Bachelor,280391.67,23220.0,74.0,0,Personal Auto,Four-Door Car,251.334247 +EA27048,California,F,High School or Below,864650.41,64125.0,108.0,0,Personal Auto,SUV,369.818708 +UT38865,Oregon,F,College,742587.06,58042.0,62.0,0,Corporate Auto,Four-Door Car,161.419528 +QC89139,Oregon,F,High School or Below,452873.74,90034.0,112.0,0,Corporate Auto,SUV,537.6 +LA14484,Nevada,M,High School or Below,222707.28,27972.0,61.0,0,Special Auto,Four-Door Car,292.8 +HN57556,California,F,High School or Below,729294.88,0.0,65.0,0,Personal Auto,Four-Door Car,312.0 +CV31235,Arizona,M,Bachelor,318435.52,50989.0,80.0,0,Corporate Auto,Four-Door Car,255.999709 +WR45726,Arizona,F,Bachelor,1131520.37,11885.0,101.0,0,Special Auto,Four-Door Car,484.8 +LB25094,California,F,Bachelor,253070.51,89451.0,63.0,0,Special Auto,Four-Door Car,61.769564 +KW56110,Oregon,M,Bachelor,1836155.53,0.0,182.0,0,Personal Auto,Luxury,1310.4 +XO36233,Washington,M,Bachelor,864153.0,78904.0,109.0,0,Personal Auto,SUV,250.001424 +ZX86243,Arizona,M,Doctor,327853.19,70247.0,83.0,1,Personal Auto,Four-Door Car,141.799422 +DW29763,Arizona,M,High School or Below,527198.21,32653.0,67.0,0,Personal Auto,Two-Door Car,321.6 +CT83377,Washington,M,High School or Below,376363.77,93595.0,97.0,4,Special Auto,Four-Door Car,49.797016 +OQ90898,California,M,Master,1395556.96,90279.0,115.0,0,Personal Auto,SUV,372.175592 +GO77248,Oregon,F,College,500152.75,0.0,72.0,0,Personal Auto,Four-Door Car,542.14385 +QW33258,California,M,Bachelor,708283.04,53310.0,189.0,3,Personal Auto,Luxury,1360.8 +OU79745,California,M,College,761948.28,0.0,105.0,0,Personal Auto,Four-Door Car,504.0 +VZ79886,Oregon,F,Bachelor,1255088.2,22234.0,160.0,0,Personal Auto,SUV,768.0 +FI92440,Washington,F,High School or Below,3219660.04,91375.0,99.0,0,Personal Auto,Two-Door Car,72.632934 +YG85980,Nevada,F,High School or Below,679377.41,22250.0,86.0,0,Personal Auto,Two-Door Car,720.601429 +QM74621,Oregon,M,Bachelor,527231.97,0.0,80.0,0,Personal Auto,Four-Door Car,576.0 +EI71732,Oregon,F,Doctor,626534.33,0.0,84.0,1,Personal Auto,Four-Door Car,481.025786 +VN79010,California,F,High School or Below,854758.61,51179.0,71.0,0,Corporate Auto,Four-Door Car,466.176731 +FI61723,California,M,Bachelor,278742.37,38667.0,72.0,0,Personal Auto,Four-Door Car,159.266473 +OH55411,California,F,Master,462680.11,79487.0,114.0,0,Corporate Auto,SUV,547.2 +TF10720,Nevada,F,Doctor,866336.4,67763.0,107.0,2,Personal Auto,Four-Door Car,41.283167 +NW30838,Nevada,M,High School or Below,387222.22,0.0,62.0,2,Corporate Auto,Four-Door Car,503.808329 +CB58476,Oregon,F,College,517081.15,0.0,71.0,0,Corporate Auto,Four-Door Car,859.599411 +WI69346,California,F,Master,896028.02,71943.0,112.0,0,Corporate Auto,SUV,305.653785 +FS76657,Oregon,F,College,547183.43,53526.0,68.0,0,Personal Auto,Four-Door Car,278.902846 +YX89016,Oregon,M,College,3493100.17,35005.0,295.0,0,Personal Auto,Luxury,1416.0 +PK28821,California,M,College,262039.23,24721.0,67.0,0,Personal Auto,Four-Door Car,139.963594 +MB51200,Washington,M,College,1906949.95,0.0,102.0,2,Personal Auto,Four-Door Car,734.4 +XG44587,Arizona,M,Master,575744.23,88997.0,72.0,0,Personal Auto,Four-Door Car,174.041566 +FG91922,Arizona,M,Master,4022401.36,48587.0,111.0,0,Personal Auto,SUV,532.8 +OM99303,Arizona,F,High School or Below,270148.83,76310.0,67.0,0,Personal Auto,Two-Door Car,321.6 +RV67546,California,M,Bachelor,371243.05,73205.0,92.0,0,Personal Auto,Four-Door Car,37.299865 +UJ79253,Oregon,F,College,2185084.0,51056.0,78.0,0,Personal Auto,Four-Door Car,95.816516 +PN98247,California,M,College,784016.58,58414.0,210.0,2,Personal Auto,Luxury,1008.0 +IB67546,California,F,Bachelor,823703.79,23940.0,107.0,0,Personal Auto,SUV,513.6 +OE19087,California,F,High School or Below,224347.39,0.0,62.0,0,Personal Auto,Four-Door Car,446.4 +CM95716,California,M,Bachelor,843446.41,44216.0,71.0,0,Personal Auto,Four-Door Car,72.205362 +MW62634,California,M,High School or Below,222707.28,27972.0,61.0,0,Corporate Auto,Four-Door Car,292.8 +QW67581,Arizona,F,High School or Below,517002.6,0.0,69.0,0,Personal Auto,Four-Door Car,331.2 +SN16059,California,F,Master,264144.61,29305.0,66.0,0,Personal Auto,Four-Door Car,475.2 +OE51254,California,F,College,279068.3,53882.0,69.0,0,Personal Auto,Four-Door Car,331.2 +RM42344,Oregon,M,College,274512.98,91757.0,69.0,1,Personal Auto,Four-Door Car,331.2 +GB35238,California,F,Bachelor,757953.27,33906.0,64.0,0,Personal Auto,Two-Door Car,401.592109 +ML82674,Oregon,M,Bachelor,1097878.03,68158.0,139.0,1,Personal Auto,SUV,253.183568 +EI85244,California,M,College,825506.01,0.0,134.0,3,Personal Auto,SUV,643.2 +DE28132,Oregon,M,College,474773.46,42165.0,123.0,0,Corporate Auto,SUV,799.673766 +TV25678,Washington,M,College,354090.43,0.0,101.0,0,Personal Auto,SUV,727.2 +TY26512,California,M,Doctor,343613.43,30817.0,88.0,0,Personal Auto,Four-Door Car,91.834668 +OB69153,California,M,Bachelor,258218.53,68074.0,65.0,0,Personal Auto,Four-Door Car,27.987867 +QZ77637,Washington,F,College,1166509.78,84978.0,35353.0,1,Corporate Auto,Four-Door Car,166.77296 +XN41715,California,F,Master,739628.37,71135.0,92.0,1,Personal Auto,Four-Door Car,270.563995 +QR15857,California,F,College,433079.98,0.0,61.0,0,Personal Auto,Two-Door Car,292.8 +FL69363,Oregon,M,Master,907576.82,37722.0,116.0,0,Personal Auto,Luxury,158.077504 +IS30295,Arizona,F,Bachelor,1463545.16,0.0,139.0,0,Personal Auto,SUV,667.2 +WA25797,Washington,M,High School or Below,856476.82,95697.0,107.0,0,Personal Auto,Luxury,178.006524 +NL59519,California,F,College,1156568.75,64642.0,96.0,0,Personal Auto,Four-Door Car,404.265696 +ZU93025,Oregon,F,College,277104.5,50071.0,71.0,0,Personal Auto,Two-Door Car,18.918935 +DK94262,Oregon,M,High School or Below,850712.88,46754.0,106.0,1,Personal Auto,SUV,513.818403 +UQ30615,California,M,College,758211.38,64801.0,64.0,0,Corporate Auto,Four-Door Car,268.471802 +OR40060,Arizona,M,Bachelor,332309.25,70410.0,83.0,0,Personal Auto,Four-Door Car,131.828507 +DK32872,Nevada,F,High School or Below,523433.17,66957.0,131.0,1,Personal Auto,SUV,628.8 +FA46418,Nevada,F,High School or Below,2470959.96,24213.0,78.0,1,Personal Auto,Four-Door Car,374.4 +ER19995,Washington,F,College,1778627.78,99790.0,6464.0,0,Personal Auto,Four-Door Car,178.986788 +KI75855,Oregon,M,Master,255122.67,79751.0,63.0,0,Personal Auto,Two-Door Car,392.235698 +ND41876,Arizona,M,High School or Below,724771.37,86122.0,182.0,1,Personal Auto,Luxury,873.6 +PN21042,Arizona,M,Bachelor,453884.78,82297.0,116.0,0,Personal Auto,Luxury,0.382107 +GJ43254,Washington,M,College,3164210.46,89057.0,98.0,0,Corporate Auto,Two-Door Car,187.363583 +AL46984,California,M,High School or Below,873042.2,43259.0,73.0,0,Personal Auto,Four-Door Car,350.4 +JP58047,Oregon,M,College,833273.06,0.0,79.0,0,Personal Auto,Four-Door Car,379.2 +ZE85014,California,M,College,235774.7,25064.0,62.0,0,Personal Auto,Four-Door Car,297.6 +KU88219,Arizona,M,Master,463716.4,25816.0,119.0,0,Personal Auto,Luxury,571.2 +UU98729,California,M,Bachelor,535719.27,0.0,73.0,0,Personal Auto,Four-Door Car,350.853987 +WS82822,Oregon,F,College,539197.1,41662.0,69.0,0,Corporate Auto,Four-Door Car,217.973168 +YB49933,Arizona,M,Bachelor,369414.05,96170.0,92.0,0,Personal Auto,Four-Door Car,441.6 +XC16387,Arizona,F,High School or Below,504041.24,46072.0,64.0,0,Personal Auto,Four-Door Car,25.934064 +XJ96748,Arizona,F,High School or Below,2749542.19,37931.0,99.0,0,Personal Auto,Four-Door Car,475.2 +TM98684,Oregon,M,High School or Below,484228.5,35127.0,62.0,0,Personal Auto,Four-Door Car,297.6 +AY18433,Washington,F,High School or Below,2738281.89,45473.0,76.0,0,Special Auto,Two-Door Car,188.938397 +DM74502,Nevada,F,College,522710.19,93087.0,131.0,3,Corporate Auto,Luxury,628.8 +FT56968,Arizona,M,High School or Below,259009.6,22398.0,67.0,2,Personal Auto,Four-Door Car,321.6 +OX36896,California,M,High School or Below,1053607.8,92983.0,87.0,1,Corporate Auto,Four-Door Car,153.205591 +BZ65376,Arizona,M,Bachelor,858127.87,27689.0,239.0,2,Personal Auto,Luxury,2893.239678 +LN34660,California,F,College,946311.33,69654.0,118.0,0,Corporate Auto,SUV,629.532731 +JC29295,California,F,Bachelor,1344100.64,80744.0,111.0,0,Personal Auto,SUV,361.284757 +KJ87930,California,F,Bachelor,388650.48,0.0,112.0,0,Corporate Auto,SUV,1185.988301 +XT36360,Arizona,F,High School or Below,678489.37,0.0,64.0,1,Personal Auto,Four-Door Car,460.8 +IX35050,Arizona,M,Bachelor,2359468.02,76358.0,66.0,0,Special Auto,Four-Door Car,86.461582 +UN97379,Oregon,M,Bachelor,253862.63,18608.0,71.0,0,Corporate Auto,Four-Door Car,340.8 +MR57294,California,M,High School or Below,563994.2,73168.0,70.0,0,Personal Auto,Four-Door Car,425.800112 +UG79499,Washington,M,Bachelor,1168137.43,70930.0,99.0,0,Personal Auto,Four-Door Car,190.43446 +UA50747,Washington,F,High School or Below,2599775.0,62262.0,72.0,0,Corporate Auto,Four-Door Car,193.505325 +GL20444,Nevada,F,Master,1377836.93,91474.0,113.0,0,Corporate Auto,Two-Door Car,24.087774 +SP58110,California,F,Bachelor,492318.17,61469.0,63.0,5,Personal Auto,Four-Door Car,302.4 +XM91635,Arizona,F,High School or Below,227233.54,16618.0,62.0,0,Special Auto,Four-Door Car,219.288706 +TV82603,California,F,Bachelor,1489539.8,48081.0,188.0,0,Personal Auto,Luxury,881.360959 +BB82067,Oregon,M,Doctor,975604.5,67632.0,121.0,0,Personal Auto,Luxury,26.951627 +JP94676,Oregon,F,Bachelor,942297.41,34115.0,119.0,0,Personal Auto,SUV,466.122541 +VU53417,Arizona,M,High School or Below,383735.76,23051.0,99.0,0,Personal Auto,Two-Door Car,475.2 +IW54795,California,M,College,1095213.19,23748.0,99.0,0,Personal Auto,Four-Door Car,607.095655 +RN78170,Arizona,F,College,815913.66,40589.0,69.0,0,Corporate Auto,Four-Door Car,331.2 +IX55883,California,F,College,1948049.98,50809.0,83.0,0,Personal Auto,Four-Door Car,290.381707 +XM72420,Arizona,F,High School or Below,391936.67,66676.0,97.0,0,Personal Auto,Four-Door Car,558.099357 +GC15104,Nevada,F,Bachelor,798514.21,52339.0,70.0,3,Corporate Auto,Four-Door Car,336.0 +RX13282,Oregon,M,Bachelor,1216874.49,14973.0,115.0,0,Personal Auto,SUV,828.0 +QA85890,Arizona,F,High School or Below,584932.15,0.0,83.0,0,Corporate Auto,Four-Door Car,540.514115 +IR62668,Arizona,F,Bachelor,508583.66,31546.0,65.0,0,Personal Auto,Four-Door Car,100.049832 +AL96740,California,F,College,290393.98,67763.0,73.0,1,Personal Auto,Four-Door Car,59.861963 +SS48498,Washington,F,College,627317.34,20836.0,79.0,0,Corporate Auto,Four-Door Car,193.57032 +PE39479,Washington,M,College,1832141.9,88592.0,76.0,0,Corporate Auto,Four-Door Car,199.79727 +JH62891,Oregon,F,College,517870.42,66943.0,65.0,1,Special Auto,Four-Door Car,53.084753 +FI20423,Arizona,F,High School or Below,1402435.84,81872.0,115.0,0,Special Auto,Four-Door Car,256.43803 +PM13394,Washington,F,College,530943.59,22404.0,70.0,1,Personal Auto,Four-Door Car,211.136067 +YV67971,California,F,High School or Below,494980.38,21342.0,62.0,0,Personal Auto,Four-Door Car,74.350893 +QD31377,California,M,Bachelor,859566.53,34621.0,108.0,1,Corporate Auto,SUV,621.464468 +YG10247,Oregon,M,College,2295189.2,62396.0,64.0,0,Personal Auto,Four-Door Car,307.2 +FE73696,Oregon,M,High School or Below,379213.03,97212.0,93.0,0,Personal Auto,Two-Door Car,360.05589 +SW19699,Arizona,F,Bachelor,275574.8,49648.0,70.0,0,Personal Auto,Four-Door Car,65.954813 +QJ40732,Arizona,M,College,488033.96,97984.0,61.0,1,Personal Auto,Four-Door Car,407.450118 +HM76207,California,F,College,905190.53,26308.0,114.0,0,Corporate Auto,SUV,547.2 +NT59303,Oregon,F,College,1011544.62,63528.0,256.0,0,Personal Auto,Luxury,1228.8 +PU41393,Nevada,M,College,826907.54,20225.0,114.0,1,Special Auto,SUV,547.2 +QO86948,Nevada,M,High School or Below,807165.3,0.0,112.0,0,Personal Auto,SUV,806.4 +QN10888,Oregon,F,High School or Below,772699.36,87620.0,64.0,0,Personal Auto,Four-Door Car,24.063693 +VY19543,California,F,Bachelor,831113.59,0.0,72.0,0,Corporate Auto,Four-Door Car,311.329282 +XC15133,Nevada,F,Master,257402.04,34990.0,65.0,0,Personal Auto,Four-Door Car,42.689135 +ST43550,Oregon,M,Bachelor,572732.71,99934.0,71.0,0,Special Auto,Four-Door Car,460.323855 +FX36546,Washington,M,Master,367914.21,60804.0,92.0,0,Personal Auto,Four-Door Car,213.225001 +JX68983,Oregon,M,Bachelor,274451.96,94648.0,69.0,0,Personal Auto,Four-Door Car,331.2 +HX78576,California,F,High School or Below,563674.03,24516.0,71.0,0,Personal Auto,Four-Door Car,300.607591 +ZQ11381,Arizona,M,Bachelor,1687038.82,61063.0,85.0,0,Personal Auto,Four-Door Car,262.504882 +ON39271,California,M,Master,273800.2,0.0,74.0,0,Personal Auto,Two-Door Car,263.365432 +SB18278,Oregon,M,Bachelor,464470.05,0.0,64.0,0,Corporate Auto,Four-Door Car,307.2 +ZT30559,California,F,High School or Below,474668.65,15169.0,63.0,0,Personal Auto,Four-Door Car,302.4 +XI41106,Arizona,M,College,1687432.82,55390.0,71.0,0,Corporate Auto,Two-Door Car,256.268091 +ZS88847,Oregon,F,Bachelor,238760.61,27592.0,62.0,0,Personal Auto,Four-Door Car,297.6 +RU49126,Washington,F,College,446533.57,61846.0,112.0,0,Personal Auto,SUV,215.8182 +KR62797,Arizona,F,High School or Below,459162.59,83297.0,113.0,0,Personal Auto,SUV,542.4 +ZJ73220,Arizona,F,College,1309258.58,0.0,188.0,0,Special Auto,Luxury,1353.6 +FY62633,Oregon,M,Bachelor,911226.66,0.0,90.0,0,Personal Auto,Four-Door Car,432.0 +CU36986,California,F,High School or Below,416516.66,55897.0,104.0,0,Personal Auto,Four-Door Car,499.2 +WZ53904,Arizona,M,Bachelor,265998.06,21297.0,71.0,0,Personal Auto,Four-Door Car,45.507952 +AA71604,Arizona,F,Master,1198659.21,87560.0,98.0,1,Personal Auto,Two-Door Car,470.4 +TD10493,Oregon,F,High School or Below,289873.27,0.0,96.0,4,Personal Auto,Four-Door Car,691.2 +LY97989,Oregon,F,Bachelor,289424.39,0.0,85.0,0,Personal Auto,Four-Door Car,408.0 +VX39856,Arizona,F,Doctor,350045.44,89398.0,86.0,0,Personal Auto,Four-Door Car,82.409922 +TP51897,California,F,College,262180.86,36843.0,68.0,3,Corporate Auto,Four-Door Car,357.642982 +QQ89253,Oregon,F,College,1022180.5,0.0,134.0,0,Personal Auto,SUV,643.2 +EI91403,California,M,High School or Below,257827.1,34946.0,65.0,0,Personal Auto,Two-Door Car,420.35698 +QG15435,Arizona,F,College,624259.57,75680.0,78.0,0,Personal Auto,Four-Door Car,136.787725 +FZ55002,Nevada,F,Doctor,522028.1,0.0,69.0,0,Personal Auto,Four-Door Car,331.2 +HX77930,Washington,F,College,313643.21,49532.0,79.0,1,Personal Auto,Four-Door Car,220.186677 +UN37063,Arizona,M,Bachelor,452536.58,10269.0,65.0,0,Personal Auto,Two-Door Car,170.798204 +VB87946,California,M,College,497035.73,49714.0,63.0,3,Personal Auto,Four-Door Car,266.165535 +AB60627,California,M,High School or Below,1546778.9,77517.0,129.0,0,Corporate Auto,SUV,98.921782 +TA34903,Oregon,M,High School or Below,583889.92,81082.0,73.0,0,Personal Auto,Four-Door Car,281.295903 +AQ51368,Oregon,F,Bachelor,1065688.2,72540.0,88.0,0,Corporate Auto,Two-Door Car,631.743039 +NZ26102,Oregon,F,High School or Below,228961.87,0.0,65.0,0,Personal Auto,Four-Door Car,468.0 +GB45753,California,M,High School or Below,543980.42,61546.0,68.0,0,Corporate Auto,Two-Door Car,29.209521 +BV79904,California,F,Master,795615.01,44818.0,67.0,1,Personal Auto,Two-Door Car,136.883999 +OB49075,Arizona,M,Bachelor,445811.34,17622.0,65.0,1,Personal Auto,Four-Door Car,312.0 +DS97676,Oregon,F,College,255505.15,0.0,72.0,0,Personal Auto,Four-Door Car,518.4 +JO63462,California,M,Bachelor,330799.9,79797.0,84.0,0,Corporate Auto,Two-Door Car,31.755601 +NJ10602,Washington,F,College,845905.32,92717.0,70.0,0,Personal Auto,Two-Door Car,224.27582 +RS24501,Oregon,F,College,1335012.09,28919.0,173.0,0,Personal Auto,SUV,830.4 +VT78274,Arizona,M,College,493122.13,0.0,68.0,0,Personal Auto,Four-Door Car,480.159011 +SU56153,Nevada,M,Bachelor,777683.52,63568.0,65.0,0,Corporate Auto,Two-Door Car,390.792553 +MN20737,Nevada,F,College,255367.22,73935.0,64.0,1,Corporate Auto,Four-Door Car,72.071195 +KL43114,Arizona,F,High School or Below,487646.97,0.0,66.0,0,Corporate Auto,Two-Door Car,316.8 +YQ15567,Oregon,F,Bachelor,903430.58,18846.0,115.0,0,Personal Auto,SUV,552.0 +TR88637,Arizona,F,High School or Below,810591.08,38893.0,103.0,0,Personal Auto,SUV,41.965252 +TC88986,Oregon,M,High School or Below,561968.91,0.0,153.0,0,Special Auto,SUV,1027.000029 +XX88577,California,M,Bachelor,1572713.06,84824.0,196.0,0,Corporate Auto,SUV,319.820747 +NE49052,California,F,High School or Below,661801.64,20068.0,86.0,0,Corporate Auto,Four-Door Car,411.011162 +KX17826,Oregon,M,Doctor,467004.8,0.0,125.0,0,Corporate Auto,SUV,600.0 +CC91503,Arizona,F,High School or Below,1016936.98,0.0,135.0,0,Personal Auto,Luxury,648.0 +WH32183,California,M,Bachelor,832307.4,97245.0,70.0,0,Personal Auto,Four-Door Car,4.110585 +ES90681,California,F,College,241776.0,51808.0,61.0,1,Personal Auto,Four-Door Car,351.149904 +DW96592,California,M,Bachelor,804487.24,71391.0,67.0,0,Personal Auto,Four-Door Car,284.000172 +MT23134,Oregon,M,High School or Below,532572.45,0.0,73.0,0,Personal Auto,Two-Door Car,496.474767 +BM69081,Arizona,M,Bachelor,694752.4,0.0,100.0,0,Personal Auto,SUV,925.137143 +MB90871,Oregon,F,College,584741.52,23496.0,77.0,0,Special Auto,Four-Door Car,13.164097 +GT62080,Washington,M,High School or Below,588174.235,55561.0,63.0,0,Personal Auto,Four-Door Car,227.872071 +QL77686,Nevada,F,College,472478.61,23986.0,119.0,0,Corporate Auto,SUV,463.335061 +ON77827,Arizona,F,Master,279022.8,22974.0,71.0,0,Personal Auto,Four-Door Car,180.667969 +KP18988,Oregon,F,High School or Below,2153133.28,0.0,101.0,0,Personal Auto,Four-Door Car,484.8 +TI92884,Arizona,M,Bachelor,1262283.27,61844.0,106.0,0,Personal Auto,Luxury,508.8 +JH73503,Arizona,M,Doctor,2017196.15,24804.0,73.0,0,Personal Auto,Two-Door Car,350.4 +YE97964,California,F,Bachelor,1646436.59,27760.0,104.0,0,Personal Auto,SUV,302.764283 +VA30351,Oregon,F,High School or Below,559538.99,74454.0,71.0,0,Personal Auto,Four-Door Car,340.8 +PV55726,Oregon,F,Master,417068.73,29462.0,107.0,1,Personal Auto,SUV,513.6 +UC88305,Arizona,F,College,266544.71,52266.0,68.0,0,Corporate Auto,Two-Door Car,141.922839 +TS53809,Oregon,M,Bachelor,709891.41,0.0,70.0,0,Personal Auto,Two-Door Car,349.783046 +ZV32120,California,M,Doctor,397134.51,23599.0,103.0,0,Corporate Auto,SUV,494.4 +FB80807,Oregon,M,Bachelor,552821.28,36088.0,72.0,0,Personal Auto,Four-Door Car,345.6 +AS55677,California,F,High School or Below,833899.58,70534.0,104.0,0,Personal Auto,Four-Door Car,54.065538 +WA15684,Oregon,M,College,3844585.59,27398.0,125.0,1,Personal Auto,SUV,600.0 +SA50567,Nevada,M,Bachelor,544855.52,85296.0,68.0,0,Personal Auto,Four-Door Car,342.515136 +KJ31611,Arizona,M,High School or Below,1080806.6,31063.0,92.0,0,Personal Auto,Four-Door Car,441.6 +VL37375,California,M,Bachelor,618509.65,0.0,92.0,0,Personal Auto,Two-Door Car,1027.177255 +KN21017,Nevada,M,High School or Below,320822.59,52367.0,81.0,0,Personal Auto,Four-Door Car,275.989978 +PX44289,Arizona,M,College,548010.41,58651.0,71.0,0,Personal Auto,Four-Door Car,472.599683 +AM97901,Nevada,F,College,2298615.39,84831.0,192.0,0,Special Auto,Luxury,1336.931716 +RE42925,Oregon,M,Bachelor,1310792.59,49088.0,114.0,1,Corporate Auto,SUV,547.2 +TR81766,California,F,College,746292.63,70263.0,93.0,0,Corporate Auto,Two-Door Car,7.345946 +CH85057,Oregon,F,Doctor,1146399.1,45354.0,285.0,0,Personal Auto,Luxury,540.141566 +UP71482,Arizona,M,High School or Below,723613.25,0.0,63.0,0,Personal Auto,Four-Door Car,383.363758 +EG40670,California,F,Bachelor,623268.79,28334.0,83.0,0,Special Auto,Four-Door Car,537.765151 +HV83672,Oregon,F,Bachelor,2839332.99,38772.0,90.0,0,Personal Auto,Four-Door Car,321.873474 +MG10140,Oregon,F,College,374675.16,41479.0,94.0,1,Personal Auto,Two-Door Car,19.575683 +TC44716,California,M,Bachelor,2156933.73,23909.0,119.0,0,Personal Auto,SUV,571.2 +QO65264,California,M,College,501208.37,48328.0,63.0,0,Personal Auto,Two-Door Car,108.138715 +EB66698,California,M,High School or Below,337185.84,86689.0,85.0,0,Corporate Auto,Two-Door Car,408.0 +OT52034,California,M,Bachelor,386477.68,24204.0,99.0,1,Personal Auto,Four-Door Car,707.303416 +CH85444,Oregon,M,College,414571.19,25943.0,110.0,0,Corporate Auto,Two-Door Car,1067.333126 +PU85769,California,M,High School or Below,515607.27,0.0,73.0,0,Personal Auto,Four-Door Car,807.947292 +UI73201,California,M,College,366737.5,62375.0,92.0,0,Personal Auto,Two-Door Car,618.630955 +SL50592,California,F,High School or Below,783568.35,0.0,71.0,0,Corporate Auto,Four-Door Car,404.272806 +XP11075,Arizona,M,Bachelor,1456726.84,0.0,148.0,0,Personal Auto,SUV,710.4 +SI31236,Oregon,M,Bachelor,1017133.9,70200.0,65.0,0,Corporate Auto,Four-Door Car,312.0 +JN26745,Nevada,F,Bachelor,413577.52,0.0,112.0,0,Special Auto,Four-Door Car,707.977614 +VK48036,Oregon,F,College,551149.11,79027.0,70.0,0,Corporate Auto,Four-Door Car,336.0 +JX76668,Washington,F,High School or Below,1131424.39,62935.0,141.0,0,Personal Auto,Luxury,232.242326 +DS45802,California,F,High School or Below,541461.73,26893.0,68.0,0,Personal Auto,Four-Door Car,68.226001 +OA96690,Oregon,F,High School or Below,742159.35,47406.0,94.0,1,Personal Auto,Four-Door Car,287.149807 +EM27919,California,M,Bachelor,445811.34,17622.0,65.0,1,Personal Auto,Four-Door Car,312.0 +QO41043,Oregon,F,College,1447612.49,27572.0,124.0,0,Corporate Auto,SUV,595.2 +OV50124,Oregon,F,College,493688.84,0.0,72.0,2,Personal Auto,Two-Door Car,391.636628 +PR31642,Oregon,F,Bachelor,452527.65,32802.0,114.0,0,Personal Auto,SUV,547.2 +BU41599,Washington,F,Master,558176.13,62739.0,70.0,0,Personal Auto,Two-Door Car,239.328571 +TK30357,California,F,Bachelor,1413434.74,90844.0,118.0,0,Personal Auto,SUV,232.674417 +NF31087,Nevada,F,High School or Below,2472318.31,44685.0,69.0,0,Personal Auto,Four-Door Car,331.2 +NH16984,California,F,Bachelor,283806.78,0.0,80.0,0,Personal Auto,Four-Door Car,336.50961 +OS75493,California,F,High School or Below,384848.36,42589.0,98.0,0,Corporate Auto,Four-Door Car,470.4 +VT63298,Oregon,M,Bachelor,1950447.39,0.0,72.0,0,Personal Auto,Four-Door Car,345.6 +QS75550,Washington,F,Bachelor,248004.59,93383.0,62.0,0,Corporate Auto,Two-Door Car,244.212286 +SZ16483,Arizona,F,High School or Below,436137.29,79583.0,109.0,2,Personal Auto,Four-Door Car,523.2 +VM92311,Arizona,F,High School or Below,252907.75,89129.0,64.0,0,Personal Auto,Four-Door Car,328.870868 +NJ46849,Arizona,M,College,250444.48,0.0,69.0,0,Personal Auto,Four-Door Car,496.8 +WZ31900,Oregon,F,Bachelor,864970.06,94389.0,107.0,0,Corporate Auto,SUV,85.063708 +RG30482,Oregon,F,College,1366835.53,0.0,197.0,0,Personal Auto,SUV,1418.4 +ZM86949,Oregon,F,High School or Below,2063508.46,84106.0,64.0,0,Personal Auto,Two-Door Car,334.408717 +QQ39596,Arizona,F,College,251753.36,0.0,69.0,0,Personal Auto,Four-Door Car,42.096415 +FH51383,California,F,High School or Below,532667.77,76717.0,66.0,0,Personal Auto,Two-Door Car,300.528579 +BJ53923,Arizona,M,High School or Below,260027.21,51978.0,66.0,0,Corporate Auto,Four-Door Car,144.782152 +CZ96653,Oregon,F,Bachelor,853479.28,47325.0,107.0,0,Personal Auto,SUV,64.598216 +FB23788,Oregon,M,High School or Below,882883.5,86721.0,111.0,0,Corporate Auto,SUV,532.8 +NT43594,Nevada,F,Bachelor,224844.96,24910.0,63.0,1,Personal Auto,Four-Door Car,347.857619 +RJ85627,Washington,F,Bachelor,1230276.24,43817.0,62.0,1,Personal Auto,Four-Door Car,245.447622 +KJ86296,Oregon,M,High School or Below,455659.3,0.0,73.0,2,Personal Auto,Four-Door Car,525.6 +PI47776,Oregon,F,Bachelor,253070.51,89451.0,63.0,0,Corporate Auto,Four-Door Car,61.769564 +MD73554,California,M,College,525198.4,59537.0,66.0,0,Personal Auto,Two-Door Car,316.8 +UX92071,Oregon,M,High School or Below,674311.93,0.0,199.0,0,Personal Auto,Luxury,955.2 +YG44474,Oregon,M,College,1401472.13,54193.0,117.0,0,Corporate Auto,SUV,720.752945 +UH45301,Oregon,M,College,943891.56,86946.0,118.0,0,Personal Auto,Four-Door Car,340.656963 +RY92647,California,F,Bachelor,1050677.17,0.0,92.0,0,Personal Auto,Four-Door Car,546.524896 +IK12620,Arizona,F,High School or Below,421391.86,12160.0,109.0,0,Personal Auto,Four-Door Car,489.411833 +GQ66762,California,M,College,477368.64,33701.0,63.0,0,Personal Auto,Four-Door Car,171.325856 +YT69858,Washington,F,Bachelor,544142.01,85702.0,67.0,0,Personal Auto,Two-Door Car,249.085887 +XD85577,California,M,Bachelor,284226.69,69417.0,73.0,1,Personal Auto,Four-Door Car,30.874869 +TM65736,Oregon,M,Master,305955.03,38644.0,78.0,1,Personal Auto,Four-Door Car,361.455219 +VJ51327,California,F,High School or Below,2031499.76,63209.0,102.0,2,Personal Auto,SUV,207.320041 +GS98873,Arizona,F,Bachelor,323912.47,16061.0,88.0,0,Personal Auto,Four-Door Car,633.6 +CW49887,California,F,Master,462680.11,79487.0,114.0,0,Special Auto,SUV,547.2 +MY31220,California,F,College,899704.02,54230.0,112.0,0,Personal Auto,Two-Door Car,537.6 diff --git a/lab-dw-data-structuring-and-combining.ipynb b/lab-dw-data-structuring-and-combining.ipynb index ec4e3f9..ba31287 100644 --- a/lab-dw-data-structuring-and-combining.ipynb +++ b/lab-dw-data-structuring-and-combining.ipynb @@ -10,6 +10,128 @@ "# Lab | Data Structuring and Combining Data" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "fed098e8-fe86-4f29-9cf4-966166d2ba15", + "metadata": {}, + "outputs": [], + "source": [ + "# Concatenate the sales, and sales_2 vertically (along rows)\n", + "pd.concat([df_1, df_2], axis=0).reset_index(drop=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5597d7eb-fe95-4d8b-976f-5f82a0475029", + "metadata": {}, + "outputs": [], + "source": [ + "# If join='inner', only the overlapping columns are included in the result, and non-overlapping columns are exclude\n", + "pd.concat([df_1, df_2,], axis=0, join=\"inner\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b7c62056-9f1e-4484-b110-47579c280816", + "metadata": {}, + "outputs": [], + "source": [ + "# Merge the sales and revenue DataFrames on the 'Clumn_name' column (inner join)\n", + "# Only rows with a common value in the 'Date' column, present in both DataFrames, are included in the merged result.\n", + "pd.merge(df_1, df_2, on='Column_name')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "83a902d2-2a9c-442c-a902-3145c5a89101", + "metadata": {}, + "outputs": [], + "source": [ + "# If you want to perform an outer join, where all rows from both DataFrames are included, you can use how='outer'\n", + "pd.merge(df_1, df_2, on='Column_name', how='outer')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c222fd54-e744-4296-a3e0-8d246b0b9fa8", + "metadata": {}, + "outputs": [], + "source": [ + "# If you want to include all rows from the left DataFrame and only the matching rows from the right DataFrame, you can use `how='left'`.\n", + "pd.merge(df_1, df_2, on='Column_name', how='left')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "fd5db744-e35d-47db-ab93-13d91a06a268", + "metadata": {}, + "outputs": [], + "source": [ + "# Similarly, if you want to include all rows from the right DataFrame and only the matching rows from the left DataFrame, you can use `how='right'`.\n", + "pd.merge(df_1, df_2, on='Column_name', how='right')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bc327990-e111-4326-be50-ac072da56d2f", + "metadata": {}, + "outputs": [], + "source": [ + "# join(): Combines DataFrames based on their indexes. It uses the index as the key to align the rows.\n", + "# to use join, we must set one \"Column_name\" as the index for all the tables to be joined.\n", + "df_1.set_index('Column_name', inplace=True)\n", + "df_2.set_index('Column_name', inplace=True)\n", + "# then\n", + "df_sales.join([df_1, df_2], how='inner or outer')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "83d11573-b75f-4c77-b4dc-b7d0e632af2d", + "metadata": {}, + "outputs": [], + "source": [ + "# PIVOT\n", + "df.pivot(index=\"Column_1\", columns=\"Column_2\", values=\"Column_3\")\n", + "\n", + "# when providing an aggregation function, place the values in a list:\n", + "pivot_df = df.pivot_table(index='Column_1', columns='Column_2', values=['Column_3'], aggfunc='sum')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cc171d78-333f-4653-bdbc-8ff9c780d02a", + "metadata": {}, + "outputs": [], + "source": [ + "# stack(): This method \"stacks\" the data, converting the columns into rows, and results in a multi-level index. It is useful when you have a DataFrame with multiple columns representing similar data, and you want to combine them into a single column.\n", + "# BUT FIRST: Create a multi-index DataFrame using set_index with the index columns of choice.\n", + "df_multiindex = df.set_index(['Column_1', 'Column_2'])\n", + "# then\n", + "stacked_data = df_multiindex.stack()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e65ff17e-91d0-4bc5-a146-fa4a0cfd0133", + "metadata": {}, + "outputs": [], + "source": [ + "# The melt() function in pandas is used to transform a DataFrame from a wide format to a long format, which is often more suitable for certain data analysis tasks.\n", + "# For example: Melt the DataFrame, keeping 'country' and 'year' as identifier variables, and 'Population' and 'GDP' as value variables\n", + "melted_data = pd.melt(df, id_vars=['country', 'year'], value_vars=['Population', 'GDP'], var_name='Indicator', value_name='Value')\n" + ] + }, { "cell_type": "markdown", "id": "a2cdfc70-44c8-478c-81e7-2bc43fdf4986", @@ -36,14 +158,2351 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "492d06e3-92c7-4105-ac72-536db98d3244", "metadata": { "id": "492d06e3-92c7-4105-ac72-536db98d3244" }, + "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
0RB50392WashingtonUnknownMaster588174.2350.01000.00Personal AutoFour-Door Car2.704934
1QZ44356ArizonaFBachelor697953.5900.094.00Personal AutoFour-Door Car1131.464935
2AI49188NevadaFBachelor1288743.17048767.0108.00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniaMBachelor764586.1800.0106.00Corporate AutoSUV529.881344
4GA49547WashingtonMHigh School or Below536307.65036357.068.00Personal AutoFour-Door Car17.269323
....................................
1066TM65736OregonMMaster305955.03038644.078.01Personal AutoFour-Door Car361.455219
1067VJ51327CaliforniaFHigh School or Below2031499.76063209.0102.02Personal AutoSUV207.320041
1068GS98873ArizonaFBachelor323912.47016061.088.00Personal AutoFour-Door Car633.600000
1069CW49887CaliforniaFMaster462680.11079487.0114.00Special AutoSUV547.200000
1070MY31220CaliforniaFCollege899704.02054230.0112.00Personal AutoTwo-Door Car537.600000
\n", + "

1071 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education \\\n", + "0 RB50392 Washington Unknown 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", + "1066 TM65736 Oregon M Master \n", + "1067 VJ51327 California F High School or Below \n", + "1068 GS98873 Arizona F Bachelor \n", + "1069 CW49887 California F Master \n", + "1070 MY31220 California F College \n", + "\n", + " customer_lifetime_value income monthly_premium_auto \\\n", + "0 588174.235 0.0 1000.0 \n", + "1 697953.590 0.0 94.0 \n", + "2 1288743.170 48767.0 108.0 \n", + "3 764586.180 0.0 106.0 \n", + "4 536307.650 36357.0 68.0 \n", + "... ... ... ... \n", + "1066 305955.030 38644.0 78.0 \n", + "1067 2031499.760 63209.0 102.0 \n", + "1068 323912.470 16061.0 88.0 \n", + "1069 462680.110 79487.0 114.0 \n", + "1070 899704.020 54230.0 112.0 \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", + "1066 1 Personal Auto Four-Door Car \n", + "1067 2 Personal Auto SUV \n", + "1068 0 Personal Auto Four-Door Car \n", + "1069 0 Special Auto SUV \n", + "1070 0 Personal Auto Two-Door Car \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", + "1066 361.455219 \n", + "1067 207.320041 \n", + "1068 633.600000 \n", + "1069 547.200000 \n", + "1070 537.600000 \n", + "\n", + "[1071 rows x 11 columns]" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# first I import the cleaned data file from the first link, based on the work I did in the previous lab.\n", + "import pandas as pd\n", + "url = \"https://raw.githubusercontent.com/data-bootcamp-v4/data/main/file1.csv\"\n", + "insurance_company_1_df = pd.read_csv(\"insurance_company_cleaned.csv\")\n", + "insurance_company_1_df" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "b9650764-0e8b-444e-a08e-e822826227c7", + "metadata": { + "id": "492d06e3-92c7-4105-ac72-536db98d3244" + }, + "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", + "
CustomerSTGENDEREducationCustomer Lifetime ValueIncomeMonthly Premium AutoNumber of Open ComplaintsTotal Claim AmountPolicy TypeVehicle Class
0GS98873ArizonaFBachelor323912.47%16061881/0/00633.600000Personal AutoFour-Door Car
1CW49887CaliforniaFMaster462680.11%794871141/0/00547.200000Special AutoSUV
2MY31220CaliforniaFCollege899704.02%542301121/0/00537.600000Personal AutoTwo-Door Car
3UH35128OregonFCollege2580706.30%712102141/1/001027.200000Personal AutoLuxury Car
4WH52799ArizonaFCollege380812.21%94903941/0/00451.200000Corporate AutoTwo-Door Car
....................................
991HV85198ArizonaMMaster847141.75%63513701/0/00185.667213Personal AutoFour-Door Car
992BS91566ArizonaFCollege543121.91%58161681/0/00140.747286Corporate AutoFour-Door Car
993IL40123NevadaFCollege568964.41%83640701/0/00471.050488Corporate AutoTwo-Door Car
994MY32149CaliforniaFMaster368672.38%0961/0/0028.460568Personal AutoTwo-Door Car
995SA91515CaliforniaMBachelor399258.39%01111/0/00700.349052Personal AutoSUV
\n", + "

996 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " Customer ST GENDER Education Customer Lifetime Value Income \\\n", + "0 GS98873 Arizona F Bachelor 323912.47% 16061 \n", + "1 CW49887 California F Master 462680.11% 79487 \n", + "2 MY31220 California F College 899704.02% 54230 \n", + "3 UH35128 Oregon F College 2580706.30% 71210 \n", + "4 WH52799 Arizona F College 380812.21% 94903 \n", + ".. ... ... ... ... ... ... \n", + "991 HV85198 Arizona M Master 847141.75% 63513 \n", + "992 BS91566 Arizona F College 543121.91% 58161 \n", + "993 IL40123 Nevada F College 568964.41% 83640 \n", + "994 MY32149 California F Master 368672.38% 0 \n", + "995 SA91515 California M Bachelor 399258.39% 0 \n", + "\n", + " Monthly Premium Auto Number of Open Complaints Total Claim Amount \\\n", + "0 88 1/0/00 633.600000 \n", + "1 114 1/0/00 547.200000 \n", + "2 112 1/0/00 537.600000 \n", + "3 214 1/1/00 1027.200000 \n", + "4 94 1/0/00 451.200000 \n", + ".. ... ... ... \n", + "991 70 1/0/00 185.667213 \n", + "992 68 1/0/00 140.747286 \n", + "993 70 1/0/00 471.050488 \n", + "994 96 1/0/00 28.460568 \n", + "995 111 1/0/00 700.349052 \n", + "\n", + " Policy Type Vehicle Class \n", + "0 Personal Auto Four-Door Car \n", + "1 Special Auto SUV \n", + "2 Personal Auto Two-Door Car \n", + "3 Personal Auto Luxury Car \n", + "4 Corporate Auto Two-Door Car \n", + ".. ... ... \n", + "991 Personal Auto Four-Door Car \n", + "992 Corporate Auto Four-Door Car \n", + "993 Corporate Auto Two-Door Car \n", + "994 Personal Auto Two-Door Car \n", + "995 Personal Auto SUV \n", + "\n", + "[996 rows x 11 columns]" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import pandas as pd\n", + "url2 = \"https://raw.githubusercontent.com/data-bootcamp-v4/data/main/file2.csv\"\n", + "insurance_company_2_df = pd.read_csv(url2)\n", + "insurance_company_2_df" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "59e5a3e9-d2d1-4185-88b5-187d0316b5ba", + "metadata": { + "id": "492d06e3-92c7-4105-ac72-536db98d3244" + }, + "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", + "
CustomerStateCustomer Lifetime ValueEducationGenderIncomeMonthly Premium AutoNumber of Open ComplaintsPolicy TypeTotal Claim AmountVehicle Class
0SA25987Washington3479.137523High School or BelowM01040Personal Auto499.200000Two-Door Car
1TB86706Arizona2502.637401MasterM0660Personal Auto3.468912Two-Door Car
2ZL73902Nevada3265.156348BachelorF25820820Personal Auto393.600000Four-Door Car
3KX23516California4455.843406High School or BelowF01210Personal Auto699.615192SUV
4FN77294California7704.958480High School or BelowM303661012Personal Auto484.800000SUV
....................................
7065LA72316California23405.987980BachelorM71941730Personal Auto198.234764Four-Door Car
7066PK87824California3096.511217CollegeF21604790Corporate Auto379.200000Four-Door Car
7067TD14365California8163.890428BachelorM0853Corporate Auto790.784983Four-Door Car
7068UP19263California7524.442436CollegeM21941960Personal Auto691.200000Four-Door Car
7069Y167826California2611.836866CollegeM0770Corporate Auto369.600000Two-Door Car
\n", + "

7070 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " Customer State Customer Lifetime Value Education \\\n", + "0 SA25987 Washington 3479.137523 High School or Below \n", + "1 TB86706 Arizona 2502.637401 Master \n", + "2 ZL73902 Nevada 3265.156348 Bachelor \n", + "3 KX23516 California 4455.843406 High School or Below \n", + "4 FN77294 California 7704.958480 High School or Below \n", + "... ... ... ... ... \n", + "7065 LA72316 California 23405.987980 Bachelor \n", + "7066 PK87824 California 3096.511217 College \n", + "7067 TD14365 California 8163.890428 Bachelor \n", + "7068 UP19263 California 7524.442436 College \n", + "7069 Y167826 California 2611.836866 College \n", + "\n", + " Gender Income Monthly Premium Auto Number of Open Complaints \\\n", + "0 M 0 104 0 \n", + "1 M 0 66 0 \n", + "2 F 25820 82 0 \n", + "3 F 0 121 0 \n", + "4 M 30366 101 2 \n", + "... ... ... ... ... \n", + "7065 M 71941 73 0 \n", + "7066 F 21604 79 0 \n", + "7067 M 0 85 3 \n", + "7068 M 21941 96 0 \n", + "7069 M 0 77 0 \n", + "\n", + " Policy Type Total Claim Amount Vehicle Class \n", + "0 Personal Auto 499.200000 Two-Door Car \n", + "1 Personal Auto 3.468912 Two-Door Car \n", + "2 Personal Auto 393.600000 Four-Door Car \n", + "3 Personal Auto 699.615192 SUV \n", + "4 Personal Auto 484.800000 SUV \n", + "... ... ... ... \n", + "7065 Personal Auto 198.234764 Four-Door Car \n", + "7066 Corporate Auto 379.200000 Four-Door Car \n", + "7067 Corporate Auto 790.784983 Four-Door Car \n", + "7068 Personal Auto 691.200000 Four-Door Car \n", + "7069 Corporate Auto 369.600000 Two-Door Car \n", + "\n", + "[7070 rows x 11 columns]" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import pandas as pd\n", + "url3 = \"https://raw.githubusercontent.com/data-bootcamp-v4/data/main/file3.csv\"\n", + "insurance_company_3_df = pd.read_csv(url3)\n", + "insurance_company_3_df" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "965b2b85-2451-4677-8c43-847fbdd94383", + "metadata": {}, + "outputs": [], + "source": [ + "# first checking if the three tables have the same columns" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "1b181774-3d3e-4606-b762-9b541135db3c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['customer', 'state', 'gender', 'education', 'customer_lifetime_value',\n", + " 'income', 'monthly_premium_auto', 'number_of_open_complaints',\n", + " 'policy_type', 'vehicle_class', 'total_claim_amount'],\n", + " dtype='object')" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_company_1_df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "c6c4d881-c3ed-48b6-9316-105e12ca66b2", + "metadata": {}, + "outputs": [], + "source": [ + "# transforming the columns of tables 2 and 3 to the same format." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "8d0f2f22-5adf-40fc-9ea6-6b34b6ccb69d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['Customer', 'ST', 'GENDER', 'Education', 'Customer Lifetime Value',\n", + " 'Income', 'Monthly Premium Auto', 'Number of Open Complaints',\n", + " 'Total Claim Amount', 'Policy Type', 'Vehicle Class'],\n", + " dtype='object')" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_company_2_df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "08598b33-97d5-40a6-80aa-095b48f70737", + "metadata": {}, "outputs": [], "source": [ - "# Your code goes here" + "insurance_company_2_df.columns = insurance_company_2_df.columns.str.replace(\" \", \"_\", regex=False).str.strip().str.lower()" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "bec01013-b43d-477d-b2c3-9ed905638367", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['customer', 'state', 'gender', 'education', 'customer_lifetime_value',\n", + " 'income', 'monthly_premium_auto', 'number_of_open_complaints',\n", + " 'total_claim_amount', 'policy_type', 'vehicle_class'],\n", + " dtype='object')" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_company_2_df = insurance_company_2_df.rename(columns={\"st\": \"state\"})\n", + "insurance_company_2_df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "ab3d9806-d7c0-402d-b35e-b0e76e04014d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['Customer', 'State', 'Customer Lifetime Value', 'Education', 'Gender',\n", + " 'Income', 'Monthly Premium Auto', 'Number of Open Complaints',\n", + " 'Policy Type', 'Total Claim Amount', 'Vehicle Class'],\n", + " dtype='object')" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_company_3_df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "e419c7c1-f987-45f2-b714-101bfb066ea4", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['customer', 'state', 'customer_lifetime_value', 'education', 'gender',\n", + " 'income', 'monthly_premium_auto', 'number_of_open_complaints',\n", + " 'policy_type', 'total_claim_amount', 'vehicle_class'],\n", + " dtype='object')" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_company_3_df.columns = insurance_company_3_df.columns.str.replace(\" \", \"_\", regex=False).str.strip().str.lower()\n", + "insurance_company_3_df = insurance_company_3_df.rename(columns={\"st\": \"state\"})\n", + "insurance_company_3_df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "b6808a89-766d-489b-8941-6b6b3866e4a8", + "metadata": {}, + "outputs": [], + "source": [ + "# now checking if the contain the same columns" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "c50c19c5-1458-4f71-9c12-3565bd179712", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "set(insurance_company_1_df.columns) == set(insurance_company_2_df.columns) == set(insurance_company_3_df.columns)" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "232e44b6-78de-4e0a-8dde-f3f68be20b64", + "metadata": {}, + "outputs": [], + "source": [ + "# that means that we can use the same cleaning techniques we used for the first dataframe.\n", + "# we will concatenate tables 2 and 3, and then apply the cleaning." + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "2a1ce5fc-3cee-43a2-8f4c-824b18385efc", + "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_complaintstotal_claim_amountpolicy_typevehicle_class
0GS98873ArizonaFBachelor323912.47%16061881/0/00633.600000Personal AutoFour-Door Car
1CW49887CaliforniaFMaster462680.11%794871141/0/00547.200000Special AutoSUV
2MY31220CaliforniaFCollege899704.02%542301121/0/00537.600000Personal AutoTwo-Door Car
3UH35128OregonFCollege2580706.30%712102141/1/001027.200000Personal AutoLuxury Car
4WH52799ArizonaFCollege380812.21%94903941/0/00451.200000Corporate AutoTwo-Door Car
....................................
8061LA72316CaliforniaMBachelor23405.9879871941730198.234764Personal AutoFour-Door Car
8062PK87824CaliforniaFCollege3096.51121721604790379.200000Corporate AutoFour-Door Car
8063TD14365CaliforniaMBachelor8163.8904280853790.784983Corporate AutoFour-Door Car
8064UP19263CaliforniaMCollege7524.44243621941960691.200000Personal AutoFour-Door Car
8065Y167826CaliforniaMCollege2611.8368660770369.600000Corporate AutoTwo-Door Car
\n", + "

8066 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education customer_lifetime_value income \\\n", + "0 GS98873 Arizona F Bachelor 323912.47% 16061 \n", + "1 CW49887 California F Master 462680.11% 79487 \n", + "2 MY31220 California F College 899704.02% 54230 \n", + "3 UH35128 Oregon F College 2580706.30% 71210 \n", + "4 WH52799 Arizona F College 380812.21% 94903 \n", + "... ... ... ... ... ... ... \n", + "8061 LA72316 California M Bachelor 23405.98798 71941 \n", + "8062 PK87824 California F College 3096.511217 21604 \n", + "8063 TD14365 California M Bachelor 8163.890428 0 \n", + "8064 UP19263 California M College 7524.442436 21941 \n", + "8065 Y167826 California M College 2611.836866 0 \n", + "\n", + " monthly_premium_auto number_of_open_complaints total_claim_amount \\\n", + "0 88 1/0/00 633.600000 \n", + "1 114 1/0/00 547.200000 \n", + "2 112 1/0/00 537.600000 \n", + "3 214 1/1/00 1027.200000 \n", + "4 94 1/0/00 451.200000 \n", + "... ... ... ... \n", + "8061 73 0 198.234764 \n", + "8062 79 0 379.200000 \n", + "8063 85 3 790.784983 \n", + "8064 96 0 691.200000 \n", + "8065 77 0 369.600000 \n", + "\n", + " policy_type vehicle_class \n", + "0 Personal Auto Four-Door Car \n", + "1 Special Auto SUV \n", + "2 Personal Auto Two-Door Car \n", + "3 Personal Auto Luxury Car \n", + "4 Corporate Auto Two-Door Car \n", + "... ... ... \n", + "8061 Personal Auto Four-Door Car \n", + "8062 Corporate Auto Four-Door Car \n", + "8063 Corporate Auto Four-Door Car \n", + "8064 Personal Auto Four-Door Car \n", + "8065 Corporate Auto Two-Door Car \n", + "\n", + "[8066 rows x 11 columns]" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df = pd.concat([insurance_company_2_df, insurance_company_3_df], axis=0).reset_index(drop=True)\n", + "temporary_df" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "1e4b7ae6-0dce-490a-9089-a68bdb323802", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['F', 'M', nan, 'female', 'Male'], dtype=object)" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df[\"gender\"].unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "a3258ea2-fbc5-4bad-ba34-d7aa8e1aed93", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['F', 'M', nan], dtype=object)" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df[\"gender\"] = temporary_df[\"gender\"].map({\"F\" : \"F\", \"M\" : \"M\", \"Male\" : \"M\", \"female\" : \"F\", \"Femal\" : \"F\"})\n", + "temporary_df.gender.unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "7c85955e-637b-4ef9-a13e-184085cc95d0", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Arizona', 'California', 'Oregon', 'Nevada', 'Washington', 'AZ'],\n", + " dtype=object)" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df[\"state\"].unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "00510c9d-558a-47cb-a22f-95dee9328b67", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Arizona', 'California', 'Oregon', 'Nevada', 'Washington'],\n", + " dtype=object)" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df[\"state\"] = temporary_df[\"state\"].map({\"AZ\" : \"Arizona\", \"WA\" : \"Washington\", \"Cali\" : \"California\", \"Washington\" : \"Washington\", \"Arizona\" : \"Arizona\", \"Nevada\" : \"Nevada\", \"California\" : \"California\", \"Oregon\" : \"Oregon\"})\n", + "temporary_df.state.unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "4d123950-e499-4fa5-8232-6fa17138ed49", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Bachelor', 'Master', 'College', 'Doctor', 'Bachelors',\n", + " 'High School or Below'], dtype=object)" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df[\"education\"].unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "982010ba-9a5d-4d51-80a1-0fa0b51a38a2", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Bachelor', 'Master', 'College', 'Doctor', 'High School or Below'],\n", + " dtype=object)" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df[\"education\"] = temporary_df[\"education\"].map({\"Master\" : \"Master\", \"Bachelor\" : \"Bachelor\", \"Bachelors\" : \"Bachelor\", \"High School or Below\" : \"High School or Below\", \"College\" : \"College\", \"Doctor\" : \"Doctor\"})\n", + "temporary_df.education.unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "b3044811-0f48-42b1-9b78-b2372ff56d28", + "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_complaintstotal_claim_amountpolicy_typevehicle_class
0GS98873ArizonaFBachelor323912.4716061881/0/00633.600000Personal AutoFour-Door Car
1CW49887CaliforniaFMaster462680.11794871141/0/00547.200000Special AutoSUV
2MY31220CaliforniaFCollege899704.02542301121/0/00537.600000Personal AutoTwo-Door Car
3UH35128OregonFCollege2580706.30712102141/1/001027.200000Personal AutoLuxury Car
4WH52799ArizonaFCollege380812.2194903941/0/00451.200000Corporate AutoTwo-Door Car
....................................
8061LA72316CaliforniaMBachelor23405.9879871941730198.234764Personal AutoFour-Door Car
8062PK87824CaliforniaFCollege3096.51121721604790379.200000Corporate AutoFour-Door Car
8063TD14365CaliforniaMBachelor8163.8904280853790.784983Corporate AutoFour-Door Car
8064UP19263CaliforniaMCollege7524.44243621941960691.200000Personal AutoFour-Door Car
8065Y167826CaliforniaMCollege2611.8368660770369.600000Corporate AutoTwo-Door Car
\n", + "

8066 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education customer_lifetime_value income \\\n", + "0 GS98873 Arizona F Bachelor 323912.47 16061 \n", + "1 CW49887 California F Master 462680.11 79487 \n", + "2 MY31220 California F College 899704.02 54230 \n", + "3 UH35128 Oregon F College 2580706.30 71210 \n", + "4 WH52799 Arizona F College 380812.21 94903 \n", + "... ... ... ... ... ... ... \n", + "8061 LA72316 California M Bachelor 23405.98798 71941 \n", + "8062 PK87824 California F College 3096.511217 21604 \n", + "8063 TD14365 California M Bachelor 8163.890428 0 \n", + "8064 UP19263 California M College 7524.442436 21941 \n", + "8065 Y167826 California M College 2611.836866 0 \n", + "\n", + " monthly_premium_auto number_of_open_complaints total_claim_amount \\\n", + "0 88 1/0/00 633.600000 \n", + "1 114 1/0/00 547.200000 \n", + "2 112 1/0/00 537.600000 \n", + "3 214 1/1/00 1027.200000 \n", + "4 94 1/0/00 451.200000 \n", + "... ... ... ... \n", + "8061 73 0 198.234764 \n", + "8062 79 0 379.200000 \n", + "8063 85 3 790.784983 \n", + "8064 96 0 691.200000 \n", + "8065 77 0 369.600000 \n", + "\n", + " policy_type vehicle_class \n", + "0 Personal Auto Four-Door Car \n", + "1 Special Auto SUV \n", + "2 Personal Auto Two-Door Car \n", + "3 Personal Auto Luxury Car \n", + "4 Corporate Auto Two-Door Car \n", + "... ... ... \n", + "8061 Personal Auto Four-Door Car \n", + "8062 Corporate Auto Four-Door Car \n", + "8063 Corporate Auto Four-Door Car \n", + "8064 Personal Auto Four-Door Car \n", + "8065 Corporate Auto Two-Door Car \n", + "\n", + "[8066 rows x 11 columns]" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# In Customer Lifetime Value, delete the % character\n", + "\n", + "temporary_df[\"customer_lifetime_value\"] = temporary_df[\"customer_lifetime_value\"].astype(\"string\").str.strip(\"%\")\n", + "temporary_df" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "eca426f5-1225-4e97-b01b-10da601e576b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Four-Door Car', 'SUV', 'Two-Door Car', 'Luxury Car', 'Sports Car',\n", + " 'Luxury SUV'], dtype=object)" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# In vehicle class, \"Sports Car\", \"Luxury SUV\" and \"Luxury Car\" could be replaced by \"Luxury\"\n", + "temporary_df[\"vehicle_class\"].unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "5cfb7f3c-cc51-4968-a2cc-6a53d3cb0040", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Four-Door Car', 'SUV', 'Two-Door Car', 'Luxury'], dtype=object)" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df[\"vehicle_class\"] = temporary_df[\"vehicle_class\"].map({\"Four-Door Car\" : \"Four-Door Car\", \"Two-Door Car\" : \"Two-Door Car\", \"SUV\" : \"SUV\", \"Luxury SUV\" : \"Luxury\", \"Sports Car\" : \"Luxury\", \"Luxury Car\" : \"Luxury\"})\n", + "temporary_df[\"vehicle_class\"].unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "fc344b14-c41e-4c84-bfda-2098f5c8c5d1", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "customer object\n", + "state object\n", + "gender string[python]\n", + "education string[python]\n", + "customer_lifetime_value Float64\n", + "income int64\n", + "monthly_premium_auto int64\n", + "number_of_open_complaints Int64\n", + "total_claim_amount float64\n", + "policy_type string[python]\n", + "vehicle_class string[python]\n", + "dtype: object" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# formatting data types to concatenate with the clean table:\n", + "temporary_df[\"gender\"] = temporary_df[\"gender\"].astype(\"string\")\n", + "temporary_df[\"education\"] = temporary_df[\"education\"].astype(\"string\")\n", + "temporary_df[\"policy_type\"] = temporary_df[\"policy_type\"].astype(\"string\")\n", + "temporary_df[\"vehicle_class\"] = temporary_df[\"vehicle_class\"].astype(\"string\")\n", + "temporary_df[\"customer_lifetime_value\"] = temporary_df[\"customer_lifetime_value\"].astype(\"Float64\")\n", + "temporary_df[\"number_of_open_complaints\"] = temporary_df[\"number_of_open_complaints\"].astype(\"string\")\n", + "temporary_df[\"number_of_open_complaints\"] = temporary_df[\"number_of_open_complaints\"].str.split(\"/\").str[1]\n", + "temporary_df[\"number_of_open_complaints\"] = temporary_df[\"number_of_open_complaints\"].astype(\"Int64\")\n", + "temporary_df.dtypes" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "c50d0f38-0523-4c03-896c-f5606b65cc67", + "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_complaintstotal_claim_amountpolicy_typevehicle_class
0GS98873ArizonaFBachelor323912.4716061880633.600000Personal AutoFour-Door Car
1CW49887CaliforniaFMaster462680.11794871140547.200000Special AutoSUV
2MY31220CaliforniaFCollege899704.02542301120537.600000Personal AutoTwo-Door Car
3UH35128OregonFCollege2580706.37121021411027.200000Personal AutoLuxury
4WH52799ArizonaFCollege380812.2194903940451.200000Corporate AutoTwo-Door Car
....................................
8061LA72316CaliforniaMBachelor23405.987987194173<NA>198.234764Personal AutoFour-Door Car
8062PK87824CaliforniaFCollege3096.5112172160479<NA>379.200000Corporate AutoFour-Door Car
8063TD14365CaliforniaMBachelor8163.890428085<NA>790.784983Corporate AutoFour-Door Car
8064UP19263CaliforniaMCollege7524.4424362194196<NA>691.200000Personal AutoFour-Door Car
8065Y167826CaliforniaMCollege2611.836866077<NA>369.600000Corporate AutoTwo-Door Car
\n", + "

8066 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education customer_lifetime_value income \\\n", + "0 GS98873 Arizona F Bachelor 323912.47 16061 \n", + "1 CW49887 California F Master 462680.11 79487 \n", + "2 MY31220 California F College 899704.02 54230 \n", + "3 UH35128 Oregon F College 2580706.3 71210 \n", + "4 WH52799 Arizona F College 380812.21 94903 \n", + "... ... ... ... ... ... ... \n", + "8061 LA72316 California M Bachelor 23405.98798 71941 \n", + "8062 PK87824 California F College 3096.511217 21604 \n", + "8063 TD14365 California M Bachelor 8163.890428 0 \n", + "8064 UP19263 California M College 7524.442436 21941 \n", + "8065 Y167826 California M College 2611.836866 0 \n", + "\n", + " monthly_premium_auto number_of_open_complaints total_claim_amount \\\n", + "0 88 0 633.600000 \n", + "1 114 0 547.200000 \n", + "2 112 0 537.600000 \n", + "3 214 1 1027.200000 \n", + "4 94 0 451.200000 \n", + "... ... ... ... \n", + "8061 73 198.234764 \n", + "8062 79 379.200000 \n", + "8063 85 790.784983 \n", + "8064 96 691.200000 \n", + "8065 77 369.600000 \n", + "\n", + " policy_type vehicle_class \n", + "0 Personal Auto Four-Door Car \n", + "1 Special Auto SUV \n", + "2 Personal Auto Two-Door Car \n", + "3 Personal Auto Luxury \n", + "4 Corporate Auto Two-Door Car \n", + "... ... ... \n", + "8061 Personal Auto Four-Door Car \n", + "8062 Corporate Auto Four-Door Car \n", + "8063 Corporate Auto Four-Door Car \n", + "8064 Personal Auto Four-Door Car \n", + "8065 Corporate Auto Two-Door Car \n", + "\n", + "[8066 rows x 11 columns]" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "d573b6bb-38d3-4e32-a386-533d3d8daa9e", + "metadata": {}, + "outputs": [], + "source": [ + "# dropping null values" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "fdb8c864-b7b1-4493-97f1-6940d96637b2", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "customer 0\n", + "state 0\n", + "gender 5\n", + "education 0\n", + "customer_lifetime_value 4\n", + "income 0\n", + "monthly_premium_auto 0\n", + "number_of_open_complaints 7070\n", + "total_claim_amount 0\n", + "policy_type 0\n", + "vehicle_class 0\n", + "dtype: int64" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "temporary_df.isnull().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "f0e7efcd-e82e-4872-88f4-8e816877198a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "customer 0\n", + "state 0\n", + "gender 0\n", + "education 0\n", + "customer_lifetime_value 0\n", + "income 0\n", + "monthly_premium_auto 0\n", + "number_of_open_complaints 7070\n", + "total_claim_amount 0\n", + "policy_type 0\n", + "vehicle_class 0\n", + "dtype: int64" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# filling NaN gender with \"Unknown\"\n", + "temporary_df[\"gender\"] = temporary_df[\"gender\"].fillna(\"Unknown\")\n", + "# customre lifetime value with the median of temporary_df (we could do it as well with the median of all 3 tables for more accurate results, but since the temporary tables has more than 8000 rows, and only 4 values are missing, we consifer this median accurate enough.\n", + "median__temp_clv = temporary_df[\"customer_lifetime_value\"].median()\n", + "temporary_df[\"customer_lifetime_value\"] = (temporary_df[\"customer_lifetime_value\"].fillna(median__temp_clv))\n", + "temporary_df.isnull().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "df1597b6-04ea-4d70-8f27-9dc7db79fd4f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "customer 0\n", + "state 0\n", + "gender 0\n", + "education 0\n", + "customer_lifetime_value 0\n", + "income 0\n", + "monthly_premium_auto 0\n", + "number_of_open_complaints 0\n", + "total_claim_amount 0\n", + "policy_type 0\n", + "vehicle_class 0\n", + "dtype: int64" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# we consider most likely, that the reason that for 7070 customer IDs we have NaN values at open complaints, is because the actual value of them is 0.\n", + "temporary_df[\"number_of_open_complaints\"] = (temporary_df[\"number_of_open_complaints\"].fillna(0))\n", + "temporary_df.isnull().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "id": "c85c18f2-6310-46f3-9af7-1f25a54885ae", + "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
0RB50392WashingtonUnknownMaster588174.2350.01000.00Personal AutoFour-Door Car2.704934
1QZ44356ArizonaFBachelor697953.590.094.00Personal AutoFour-Door Car1131.464935
2AI49188NevadaFBachelor1288743.1748767.0108.00Personal AutoTwo-Door Car566.472247
3WW63253CaliforniaMBachelor764586.180.0106.00Corporate AutoSUV529.881344
4GA49547WashingtonMHigh School or Below536307.6536357.068.00Personal AutoFour-Door Car17.269323
....................................
9132LA72316CaliforniaMBachelor23405.9879871941.073.00Personal AutoFour-Door Car198.234764
9133PK87824CaliforniaFCollege3096.51121721604.079.00Corporate AutoFour-Door Car379.200000
9134TD14365CaliforniaMBachelor8163.8904280.085.00Corporate AutoFour-Door Car790.784983
9135UP19263CaliforniaMCollege7524.44243621941.096.00Personal AutoFour-Door Car691.200000
9136Y167826CaliforniaMCollege2611.8368660.077.00Corporate AutoTwo-Door Car369.600000
\n", + "

9137 rows × 11 columns

\n", + "
" + ], + "text/plain": [ + " customer state gender education \\\n", + "0 RB50392 Washington Unknown 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", + "9132 LA72316 California M Bachelor \n", + "9133 PK87824 California F College \n", + "9134 TD14365 California M Bachelor \n", + "9135 UP19263 California M College \n", + "9136 Y167826 California M College \n", + "\n", + " customer_lifetime_value income monthly_premium_auto \\\n", + "0 588174.235 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", + "9132 23405.98798 71941.0 73.0 \n", + "9133 3096.511217 21604.0 79.0 \n", + "9134 8163.890428 0.0 85.0 \n", + "9135 7524.442436 21941.0 96.0 \n", + "9136 2611.836866 0.0 77.0 \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", + "9132 0 Personal Auto Four-Door Car \n", + "9133 0 Corporate Auto Four-Door Car \n", + "9134 0 Corporate Auto Four-Door Car \n", + "9135 0 Personal Auto Four-Door Car \n", + "9136 0 Corporate Auto Two-Door Car \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", + "9132 198.234764 \n", + "9133 379.200000 \n", + "9134 790.784983 \n", + "9135 691.200000 \n", + "9136 369.600000 \n", + "\n", + "[9137 rows x 11 columns]" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# and now we concatenate\n", + "insurance_updated_df = pd.concat([insurance_company_1_df, temporary_df], axis=0).reset_index(drop=True)\n", + "insurance_updated_df" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "46aab717-2337-400d-9204-3f70a67c5eed", + "metadata": {}, + "outputs": [], + "source": [ + "# The rows and columns total indicate that everything has been merged coorectly." ] }, { @@ -72,14 +2531,1036 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 33, "id": "aa10d9b0-1c27-4d3f-a8e4-db6ab73bfd26", "metadata": { "id": "aa10d9b0-1c27-4d3f-a8e4-db6ab73bfd26" }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
unnamed:_0customerstatecustomer_lifetime_valueresponsecoverageeducationeffective_to_dateemploymentstatusgender...number_of_policiespolicy_typepolicyrenew_offer_typesales_channeltotal_claim_amountvehicle_classvehicle_sizevehicle_typemonth
00DK49336Arizona4809.216960NoBasicCollege2011-02-18EmployedM...9Corporate AutoCorporate L3Offer3Agent292.800000Four-Door CarMedsizeA2
11KX64629California2228.525238NoBasicCollege2011-01-18UnemployedF...1Personal AutoPersonal L3Offer4Call Center744.924331Four-Door CarMedsizeA1
22LZ68649Washington14947.917300NoBasicBachelor2011-02-10EmployedM...2Personal AutoPersonal L3Offer3Call Center480.000000SUVMedsizeA2
33XL78013Oregon22332.439460YesExtendedCollege2011-01-11EmployedM...2Corporate AutoCorporate L3Offer2Branch484.013411Four-Door CarMedsizeA1
44QA50777Oregon9025.067525NoPremiumBachelor2011-01-17Medical LeaveF...7Personal AutoPersonal L2Offer1Branch707.925645Four-Door CarMedsizeA1
..................................................................
1090510905FE99816Nevada15563.369440NoPremiumBachelor2011-01-19UnemployedF...7Personal AutoPersonal L1Offer3Web1214.400000Luxury CarMedsizeA1
1090610906KX53892Oregon5259.444853NoBasicCollege2011-01-06EmployedF...6Personal AutoPersonal L3Offer2Branch273.018929Four-Door CarMedsizeA1
1090710907TL39050Arizona23893.304100NoExtendedBachelor2011-02-06EmployedF...2Corporate AutoCorporate L3Offer1Web381.306996Luxury SUVMedsizeA2
1090810908WA60547California11971.977650NoPremiumCollege2011-02-13EmployedF...6Personal AutoPersonal L1Offer1Branch618.288849SUVMedsizeA2
1090910909IV32877California6857.519928NoBasicBachelor2011-01-08UnemployedM...3Personal AutoPersonal L1Offer4Web1021.719397SUVMedsizeA1
\n", + "

10910 rows × 27 columns

\n", + "
" + ], + "text/plain": [ + " unnamed:_0 customer state customer_lifetime_value response \\\n", + "0 0 DK49336 Arizona 4809.216960 No \n", + "1 1 KX64629 California 2228.525238 No \n", + "2 2 LZ68649 Washington 14947.917300 No \n", + "3 3 XL78013 Oregon 22332.439460 Yes \n", + "4 4 QA50777 Oregon 9025.067525 No \n", + "... ... ... ... ... ... \n", + "10905 10905 FE99816 Nevada 15563.369440 No \n", + "10906 10906 KX53892 Oregon 5259.444853 No \n", + "10907 10907 TL39050 Arizona 23893.304100 No \n", + "10908 10908 WA60547 California 11971.977650 No \n", + "10909 10909 IV32877 California 6857.519928 No \n", + "\n", + " coverage education effective_to_date employmentstatus gender ... \\\n", + "0 Basic College 2011-02-18 Employed M ... \n", + "1 Basic College 2011-01-18 Unemployed F ... \n", + "2 Basic Bachelor 2011-02-10 Employed M ... \n", + "3 Extended College 2011-01-11 Employed M ... \n", + "4 Premium Bachelor 2011-01-17 Medical Leave F ... \n", + "... ... ... ... ... ... ... \n", + "10905 Premium Bachelor 2011-01-19 Unemployed F ... \n", + "10906 Basic College 2011-01-06 Employed F ... \n", + "10907 Extended Bachelor 2011-02-06 Employed F ... \n", + "10908 Premium College 2011-02-13 Employed F ... \n", + "10909 Basic Bachelor 2011-01-08 Unemployed M ... \n", + "\n", + " number_of_policies policy_type policy renew_offer_type \\\n", + "0 9 Corporate Auto Corporate L3 Offer3 \n", + "1 1 Personal Auto Personal L3 Offer4 \n", + "2 2 Personal Auto Personal L3 Offer3 \n", + "3 2 Corporate Auto Corporate L3 Offer2 \n", + "4 7 Personal Auto Personal L2 Offer1 \n", + "... ... ... ... ... \n", + "10905 7 Personal Auto Personal L1 Offer3 \n", + "10906 6 Personal Auto Personal L3 Offer2 \n", + "10907 2 Corporate Auto Corporate L3 Offer1 \n", + "10908 6 Personal Auto Personal L1 Offer1 \n", + "10909 3 Personal Auto Personal L1 Offer4 \n", + "\n", + " sales_channel total_claim_amount vehicle_class vehicle_size \\\n", + "0 Agent 292.800000 Four-Door Car Medsize \n", + "1 Call Center 744.924331 Four-Door Car Medsize \n", + "2 Call Center 480.000000 SUV Medsize \n", + "3 Branch 484.013411 Four-Door Car Medsize \n", + "4 Branch 707.925645 Four-Door Car Medsize \n", + "... ... ... ... ... \n", + "10905 Web 1214.400000 Luxury Car Medsize \n", + "10906 Branch 273.018929 Four-Door Car Medsize \n", + "10907 Web 381.306996 Luxury SUV Medsize \n", + "10908 Branch 618.288849 SUV Medsize \n", + "10909 Web 1021.719397 SUV Medsize \n", + "\n", + " vehicle_type month \n", + "0 A 2 \n", + "1 A 1 \n", + "2 A 2 \n", + "3 A 1 \n", + "4 A 1 \n", + "... ... ... \n", + "10905 A 1 \n", + "10906 A 1 \n", + "10907 A 2 \n", + "10908 A 2 \n", + "10909 A 1 \n", + "\n", + "[10910 rows x 27 columns]" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import pandas as pd\n", + "url_marketing = \"https://raw.githubusercontent.com/data-bootcamp-v4/data/main/marketing_customer_analysis_clean.csv\"\n", + "insurance_and_marketing_df = pd.read_csv(url_marketing)\n", + "insurance_and_marketing_df" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "id": "f251c23d-260f-432d-8367-d8848ddc88bc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['unnamed:_0', 'customer', 'state', 'customer_lifetime_value',\n", + " 'response', 'coverage', 'education', 'effective_to_date',\n", + " 'employmentstatus', 'gender', 'income', 'location_code',\n", + " 'marital_status', 'monthly_premium_auto', 'months_since_last_claim',\n", + " 'months_since_policy_inception', 'number_of_open_complaints',\n", + " 'number_of_policies', 'policy_type', 'policy', 'renew_offer_type',\n", + " 'sales_channel', 'total_claim_amount', 'vehicle_class', 'vehicle_size',\n", + " 'vehicle_type', 'month'],\n", + " dtype='object')" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_and_marketing_df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "id": "a608552b-48cc-4fe5-ac82-1d53e96038a6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['customer', 'state', 'customer_lifetime_value', 'response', 'coverage',\n", + " 'education', 'effective_to_date', 'employmentstatus', 'gender',\n", + " 'income', 'location_code', 'marital_status', 'monthly_premium_auto',\n", + " 'months_since_last_claim', 'months_since_policy_inception',\n", + " 'number_of_open_complaints', 'number_of_policies', 'policy_type',\n", + " 'policy', 'renew_offer_type', 'sales_channel', 'total_claim_amount',\n", + " 'vehicle_class', 'vehicle_size', 'vehicle_type', 'month'],\n", + " dtype='object')" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_and_marketing_df = insurance_and_marketing_df.drop(columns=[\"unnamed:_0\"])\n", + "insurance_and_marketing_df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "id": "362f9436-504b-4a71-bf92-3570351acfc8", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['customer', 'state', 'customer_lifetime_value', 'response', 'coverage',\n", + " 'education', 'effective_to_date', 'employmentstatus', 'gender',\n", + " 'income', 'location_code', 'marital_status', 'monthly_premium_auto',\n", + " 'months_since_last_claim', 'months_since_policy_inception',\n", + " 'number_of_open_complaints', 'number_of_policies', 'policy_type',\n", + " 'policy', 'renew_offer_type', 'sales_channel', 'total_claim_amount',\n", + " 'vehicle_class', 'vehicle_size', 'vehicle_type', 'month'],\n", + " dtype='object')" + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_and_marketing_df.columns = insurance_and_marketing_df.columns.str.replace(\" \", \"_\", regex=False).str.strip().str.lower()\n", + "insurance_and_marketing_df.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "id": "ec16b75d-58ae-46b1-977c-3c763f63d7d4", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "customer 0\n", + "state 0\n", + "customer_lifetime_value 0\n", + "response 0\n", + "coverage 0\n", + "education 0\n", + "effective_to_date 0\n", + "employmentstatus 0\n", + "gender 0\n", + "income 0\n", + "location_code 0\n", + "marital_status 0\n", + "monthly_premium_auto 0\n", + "months_since_last_claim 0\n", + "months_since_policy_inception 0\n", + "number_of_open_complaints 0\n", + "number_of_policies 0\n", + "policy_type 0\n", + "policy 0\n", + "renew_offer_type 0\n", + "sales_channel 0\n", + "total_claim_amount 0\n", + "vehicle_class 0\n", + "vehicle_size 0\n", + "vehicle_type 0\n", + "month 0\n", + "dtype: int64" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# now that we cleaned and formatted the columns, let's check for null values and duplicates.\n", + "insurance_and_marketing_df.isnull().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "id": "57fd70a7-8cdc-4b97-8159-9aa878612d56", + "metadata": {}, + "outputs": [], + "source": [ + "# that's fantastic, Marketing does an excellent job in reporting data. \n", + "# But before we give them a golden star, let's see if there are duplicates." + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "id": "28282a37-98d7-42f7-8dba-aa0a01f5a2a2", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "np.int64(443)" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_and_marketing_df.duplicated().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "0d89a895-f81c-4f2d-99c9-92a7e7b3e57f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "np.int64(1776)" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Check for duplicates in columns where duplicates could create an issue, like customer, the rest can have duplicates.\n", + "insurance_and_marketing_df.duplicated(subset=['customer']).sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "id": "c89b1227-bbb6-4f7d-ac4d-de25500a74fc", + "metadata": {}, + "outputs": [], + "source": [ + "# if rows had empty values based on the check above, it would be essential to check which duplicates to drop, keeping those with the most values. \n", + "# since no rows have NaN values, then we can simply perform a basic duplicates drop." + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "id": "aa15b55e-2b14-430a-a0f1-f82d1491ca3d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "np.int64(0)" + ] + }, + "execution_count": 48, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# now let's drop them\n", + "insurance_and_marketing_df = insurance_and_marketing_df.drop_duplicates(subset=['customer'])\n", + "insurance_and_marketing_df.duplicated().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "507f62a2-b5c1-40cc-aabf-ecc3a61e62a6", + "metadata": {}, "outputs": [], "source": [ - "# Your code goes here" + "# the above means that all duplicated were 443, all in the customer column, and were repeated more than 4 times. After deleting the duplications, we end up with the 443 unique rows from those customers." + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "id": "34ecbf46-48b6-427c-a015-90fc224cc862", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
customerstatecustomer_lifetime_valueresponsecoverageeducationeffective_to_dateemploymentstatusgenderincome...number_of_policiespolicy_typepolicyrenew_offer_typesales_channeltotal_claim_amountvehicle_classvehicle_sizevehicle_typemonth
0DK49336Arizona4809.216960NoBasicCollege2011-02-18EmployedM48029...9Corporate AutoCorporate L3Offer3Agent292.800000Four-Door CarMedsizeA2
1KX64629California2228.525238NoBasicCollege2011-01-18UnemployedF0...1Personal AutoPersonal L3Offer4Call Center744.924331Four-Door CarMedsizeA1
2LZ68649Washington14947.917300NoBasicBachelor2011-02-10EmployedM22139...2Personal AutoPersonal L3Offer3Call Center480.000000SUVMedsizeA2
3XL78013Oregon22332.439460YesExtendedCollege2011-01-11EmployedM49078...2Corporate AutoCorporate L3Offer2Branch484.013411Four-Door CarMedsizeA1
4QA50777Oregon9025.067525NoPremiumBachelor2011-01-17Medical LeaveF23675...7Personal AutoPersonal L2Offer1Branch707.925645Four-Door CarMedsizeA1
..................................................................
10903SU71163Arizona2771.663013NoBasicCollege2011-01-07EmployedM59855...1Personal AutoPersonal L2Offer2Branch355.200000Two-Door CarMedsizeA1
10904QI63521Nevada19228.463620NoBasicHigh School or Below2011-02-24UnemployedM0...2Personal AutoPersonal L2Offer1Branch897.600000Luxury SUVMedsizeA2
10906KX53892Oregon5259.444853NoBasicCollege2011-01-06EmployedF61146...6Personal AutoPersonal L3Offer2Branch273.018929Four-Door CarMedsizeA1
10907TL39050Arizona23893.304100NoExtendedBachelor2011-02-06EmployedF39837...2Corporate AutoCorporate L3Offer1Web381.306996Luxury SUVMedsizeA2
10908WA60547California11971.977650NoPremiumCollege2011-02-13EmployedF64195...6Personal AutoPersonal L1Offer1Branch618.288849SUVMedsizeA2
\n", + "

9134 rows × 26 columns

\n", + "
" + ], + "text/plain": [ + " customer state customer_lifetime_value response coverage \\\n", + "0 DK49336 Arizona 4809.216960 No Basic \n", + "1 KX64629 California 2228.525238 No Basic \n", + "2 LZ68649 Washington 14947.917300 No Basic \n", + "3 XL78013 Oregon 22332.439460 Yes Extended \n", + "4 QA50777 Oregon 9025.067525 No Premium \n", + "... ... ... ... ... ... \n", + "10903 SU71163 Arizona 2771.663013 No Basic \n", + "10904 QI63521 Nevada 19228.463620 No Basic \n", + "10906 KX53892 Oregon 5259.444853 No Basic \n", + "10907 TL39050 Arizona 23893.304100 No Extended \n", + "10908 WA60547 California 11971.977650 No Premium \n", + "\n", + " education effective_to_date employmentstatus gender income \\\n", + "0 College 2011-02-18 Employed M 48029 \n", + "1 College 2011-01-18 Unemployed F 0 \n", + "2 Bachelor 2011-02-10 Employed M 22139 \n", + "3 College 2011-01-11 Employed M 49078 \n", + "4 Bachelor 2011-01-17 Medical Leave F 23675 \n", + "... ... ... ... ... ... \n", + "10903 College 2011-01-07 Employed M 59855 \n", + "10904 High School or Below 2011-02-24 Unemployed M 0 \n", + "10906 College 2011-01-06 Employed F 61146 \n", + "10907 Bachelor 2011-02-06 Employed F 39837 \n", + "10908 College 2011-02-13 Employed F 64195 \n", + "\n", + " ... number_of_policies policy_type policy renew_offer_type \\\n", + "0 ... 9 Corporate Auto Corporate L3 Offer3 \n", + "1 ... 1 Personal Auto Personal L3 Offer4 \n", + "2 ... 2 Personal Auto Personal L3 Offer3 \n", + "3 ... 2 Corporate Auto Corporate L3 Offer2 \n", + "4 ... 7 Personal Auto Personal L2 Offer1 \n", + "... ... ... ... ... ... \n", + "10903 ... 1 Personal Auto Personal L2 Offer2 \n", + "10904 ... 2 Personal Auto Personal L2 Offer1 \n", + "10906 ... 6 Personal Auto Personal L3 Offer2 \n", + "10907 ... 2 Corporate Auto Corporate L3 Offer1 \n", + "10908 ... 6 Personal Auto Personal L1 Offer1 \n", + "\n", + " sales_channel total_claim_amount vehicle_class vehicle_size \\\n", + "0 Agent 292.800000 Four-Door Car Medsize \n", + "1 Call Center 744.924331 Four-Door Car Medsize \n", + "2 Call Center 480.000000 SUV Medsize \n", + "3 Branch 484.013411 Four-Door Car Medsize \n", + "4 Branch 707.925645 Four-Door Car Medsize \n", + "... ... ... ... ... \n", + "10903 Branch 355.200000 Two-Door Car Medsize \n", + "10904 Branch 897.600000 Luxury SUV Medsize \n", + "10906 Branch 273.018929 Four-Door Car Medsize \n", + "10907 Web 381.306996 Luxury SUV Medsize \n", + "10908 Branch 618.288849 SUV Medsize \n", + "\n", + " vehicle_type month \n", + "0 A 2 \n", + "1 A 1 \n", + "2 A 2 \n", + "3 A 1 \n", + "4 A 1 \n", + "... ... ... \n", + "10903 A 1 \n", + "10904 A 2 \n", + "10906 A 1 \n", + "10907 A 2 \n", + "10908 A 2 \n", + "\n", + "[9134 rows x 26 columns]" + ] + }, + "execution_count": 49, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "insurance_and_marketing_df" ] }, { @@ -93,6 +3574,579 @@ "Round the total revenue to 2 decimal points. Analyze the resulting table to draw insights." ] }, + { + "cell_type": "code", + "execution_count": 51, + "id": "a2fc75f9-d5ad-45c9-bd3c-8709b593c23e", + "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", + "
customerstatecustomer_lifetime_valueresponsecoverageeducationeffective_to_dateemploymentstatusgenderincome...policy_typepolicyrenew_offer_typesales_channeltotal_claim_amountvehicle_classvehicle_sizevehicle_typemonthmonthly_premium_auto_y
0DK49336Arizona4809.216960NoBasicCollege2011-02-18EmployedM48029...Corporate AutoCorporate L3Offer3Agent292.800000Four-Door CarMedsizeA261.0
1KX64629California2228.525238NoBasicCollege2011-01-18UnemployedF0...Personal AutoPersonal L3Offer4Call Center744.924331Four-Door CarMedsizeA164.0
2LZ68649Washington14947.917300NoBasicBachelor2011-02-10EmployedM22139...Personal AutoPersonal L3Offer3Call Center480.000000SUVMedsizeA2100.0
3XL78013Oregon22332.439460YesExtendedCollege2011-01-11EmployedM49078...Corporate AutoCorporate L3Offer2Branch484.013411Four-Door CarMedsizeA197.0
4QA50777Oregon9025.067525NoPremiumBachelor2011-01-17Medical LeaveF23675...Personal AutoPersonal L2Offer1Branch707.925645Four-Door CarMedsizeA1117.0
\n", + "

5 rows × 27 columns

\n", + "
" + ], + "text/plain": [ + " customer state customer_lifetime_value response coverage education \\\n", + "0 DK49336 Arizona 4809.216960 No Basic College \n", + "1 KX64629 California 2228.525238 No Basic College \n", + "2 LZ68649 Washington 14947.917300 No Basic Bachelor \n", + "3 XL78013 Oregon 22332.439460 Yes Extended College \n", + "4 QA50777 Oregon 9025.067525 No Premium Bachelor \n", + "\n", + " effective_to_date employmentstatus gender income ... policy_type \\\n", + "0 2011-02-18 Employed M 48029 ... Corporate Auto \n", + "1 2011-01-18 Unemployed F 0 ... Personal Auto \n", + "2 2011-02-10 Employed M 22139 ... Personal Auto \n", + "3 2011-01-11 Employed M 49078 ... Corporate Auto \n", + "4 2011-01-17 Medical Leave F 23675 ... Personal Auto \n", + "\n", + " policy renew_offer_type sales_channel total_claim_amount \\\n", + "0 Corporate L3 Offer3 Agent 292.800000 \n", + "1 Personal L3 Offer4 Call Center 744.924331 \n", + "2 Personal L3 Offer3 Call Center 480.000000 \n", + "3 Corporate L3 Offer2 Branch 484.013411 \n", + "4 Personal L2 Offer1 Branch 707.925645 \n", + "\n", + " vehicle_class vehicle_size vehicle_type month monthly_premium_auto_y \n", + "0 Four-Door Car Medsize A 2 61.0 \n", + "1 Four-Door Car Medsize A 1 64.0 \n", + "2 SUV Medsize A 2 100.0 \n", + "3 Four-Door Car Medsize A 1 97.0 \n", + "4 Four-Door Car Medsize A 1 117.0 \n", + "\n", + "[5 rows x 27 columns]" + ] + }, + "execution_count": 51, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# first let's create a column for the reveue per customer.\n", + "# to calculate the total revenue per customer, I need to bring the monthly_premium_auto information from the 'insurance_updated_df'.\n", + "# we will do an inner merge, to discard the extra 3 rows that the marketing table has compared to the insurance one.\n", + "\n", + "merged_df = insurance_and_marketing_df.merge(\n", + " insurance_updated_df[[\"customer\", \"monthly_premium_auto\"]],\n", + " on=\"customer\",\n", + " how=\"inner\"\n", + ")\n", + "merged_df.head(5)" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "id": "46a1fc9d-7a17-4327-951a-d9fb38359322", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(9137, 27)" + ] + }, + "execution_count": 52, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "merged_df.shape" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "id": "1a8875c9-1d14-4f53-8e25-14f6c41104b6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "np.int64(0)" + ] + }, + "execution_count": 53, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "merged_df[\"customer\"].isnull().sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "id": "30690cb1-2e0b-4670-a789-db181a1e0dd8", + "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", + "
customerstatecustomer_lifetime_valueresponsecoverageeducationeffective_to_dateemploymentstatusgenderincome...policyrenew_offer_typesales_channeltotal_claim_amountvehicle_classvehicle_sizevehicle_typemonthmonthly_premium_auto_yrevenue
0DK49336Arizona4809.216960NoBasicCollege2011-02-18EmployedM48029...Corporate L3Offer3Agent292.800000Four-Door CarMedsizeA261.0122.0
1KX64629California2228.525238NoBasicCollege2011-01-18UnemployedF0...Personal L3Offer4Call Center744.924331Four-Door CarMedsizeA164.064.0
2LZ68649Washington14947.917300NoBasicBachelor2011-02-10EmployedM22139...Personal L3Offer3Call Center480.000000SUVMedsizeA2100.0200.0
3XL78013Oregon22332.439460YesExtendedCollege2011-01-11EmployedM49078...Corporate L3Offer2Branch484.013411Four-Door CarMedsizeA197.097.0
4QA50777Oregon9025.067525NoPremiumBachelor2011-01-17Medical LeaveF23675...Personal L2Offer1Branch707.925645Four-Door CarMedsizeA1117.0117.0
\n", + "

5 rows × 28 columns

\n", + "
" + ], + "text/plain": [ + " customer state customer_lifetime_value response coverage education \\\n", + "0 DK49336 Arizona 4809.216960 No Basic College \n", + "1 KX64629 California 2228.525238 No Basic College \n", + "2 LZ68649 Washington 14947.917300 No Basic Bachelor \n", + "3 XL78013 Oregon 22332.439460 Yes Extended College \n", + "4 QA50777 Oregon 9025.067525 No Premium Bachelor \n", + "\n", + " effective_to_date employmentstatus gender income ... policy \\\n", + "0 2011-02-18 Employed M 48029 ... Corporate L3 \n", + "1 2011-01-18 Unemployed F 0 ... Personal L3 \n", + "2 2011-02-10 Employed M 22139 ... Personal L3 \n", + "3 2011-01-11 Employed M 49078 ... Corporate L3 \n", + "4 2011-01-17 Medical Leave F 23675 ... Personal L2 \n", + "\n", + " renew_offer_type sales_channel total_claim_amount vehicle_class \\\n", + "0 Offer3 Agent 292.800000 Four-Door Car \n", + "1 Offer4 Call Center 744.924331 Four-Door Car \n", + "2 Offer3 Call Center 480.000000 SUV \n", + "3 Offer2 Branch 484.013411 Four-Door Car \n", + "4 Offer1 Branch 707.925645 Four-Door Car \n", + "\n", + " vehicle_size vehicle_type month monthly_premium_auto_y revenue \n", + "0 Medsize A 2 61.0 122.0 \n", + "1 Medsize A 1 64.0 64.0 \n", + "2 Medsize A 2 100.0 200.0 \n", + "3 Medsize A 1 97.0 97.0 \n", + "4 Medsize A 1 117.0 117.0 \n", + "\n", + "[5 rows x 28 columns]" + ] + }, + "execution_count": 55, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Now let's create the pivot table\n", + "# first we need to create a column for the revenue:\n", + "merged_df[\"revenue\"] = merged_df[\"monthly_premium_auto_y\"]*merged_df[\"month\"]\n", + "merged_df.head(5)" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "id": "88cccac9-b099-4e13-90f9-3868644e0383", + "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", + "
revenue
sales_channel
Agent644583.0
Branch405342.0
Call Center259203.0
Web191681.0
\n", + "
" + ], + "text/plain": [ + " revenue\n", + "sales_channel \n", + "Agent 644583.0\n", + "Branch 405342.0\n", + "Call Center 259203.0\n", + "Web 191681.0" + ] + }, + "execution_count": 60, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pivot_df = merged_df.pivot_table(index='sales_channel', values=['revenue'], aggfunc='sum')\n", + "pivot_df[\"revenue\"] = pivot_df[\"revenue\"].round(2)\n", + "pivot_df.head(5)" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "id": "170e5377-7a43-4339-8144-1818d829e005", + "metadata": {}, + "outputs": [], + "source": [ + "# Agents bring the most revenue for the company, followed by Branch, Call Center, and Web last" + ] + }, { "cell_type": "markdown", "id": "640993b2-a291-436c-a34d-a551144f8196", @@ -103,6 +4157,112 @@ "2. Create a pivot table that shows the average customer lifetime value per gender and education level. Analyze the resulting table to draw insights." ] }, + { + "cell_type": "code", + "execution_count": 64, + "id": "ba125153-9b1d-46a5-a52e-c2aa1df8b601", + "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", + "
customer_lifetime_value
educationBachelorCollegeDoctorHigh School or BelowMaster
gender
F7984.9109977762.2715007203.9716708572.4771478304.774639
M7694.9275807997.1835417570.9884417914.0194707953.182676
\n", + "
" + ], + "text/plain": [ + " customer_lifetime_value \\\n", + "education Bachelor College Doctor \n", + "gender \n", + "F 7984.910997 7762.271500 7203.971670 \n", + "M 7694.927580 7997.183541 7570.988441 \n", + "\n", + " \n", + "education High School or Below Master \n", + "gender \n", + "F 8572.477147 8304.774639 \n", + "M 7914.019470 7953.182676 " + ] + }, + "execution_count": 64, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pivot_2_df = merged_df.pivot_table(index='gender', columns=\"education\", values=['customer_lifetime_value'], aggfunc='mean')\n", + "pivot_2_df" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "id": "ffbb0d6c-dbba-4b62-aed9-d502570e7859", + "metadata": {}, + "outputs": [], + "source": [ + "# using the pivot table above, we can see that th total lifetime value for females is bigger than for males, \n", + "# with results varying across education level, but not at an extent that we se significant differences." + ] + }, { "cell_type": "markdown", "id": "32c7f2e5-3d90-43e5-be33-9781b6069198", @@ -130,14 +4290,254 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 70, "id": "3a069e0b-b400-470e-904d-d17582191be4", "metadata": { "id": "3a069e0b-b400-470e-904d-d17582191be4" }, - "outputs": [], + "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", + "
customerstatecustomer_lifetime_valueresponsecoverageeducationeffective_to_dateemploymentstatusgenderincome...sales_channeltotal_claim_amountvehicle_classvehicle_sizevehicle_typemonthmonthly_premium_auto_yrevenuenumber_of_open_complaints_ypolicy_type_y
0DK49336Arizona4809.216960NoBasicCollege2011-02-18EmployedM48029...Agent292.800000Four-Door CarMedsizeA261.0122.00Corporate Auto
1KX64629California2228.525238NoBasicCollege2011-01-18UnemployedF0...Call Center744.924331Four-Door CarMedsizeA164.064.00Personal Auto
2LZ68649Washington14947.917300NoBasicBachelor2011-02-10EmployedM22139...Call Center480.000000SUVMedsizeA2100.0200.00Personal Auto
3XL78013Oregon22332.439460YesExtendedCollege2011-01-11EmployedM49078...Branch484.013411Four-Door CarMedsizeA197.097.00Corporate Auto
4QA50777Oregon9025.067525NoPremiumBachelor2011-01-17Medical LeaveF23675...Branch707.925645Four-Door CarMedsizeA1117.0117.00Personal Auto
\n", + "

5 rows × 30 columns

\n", + "
" + ], + "text/plain": [ + " customer state customer_lifetime_value response coverage education \\\n", + "0 DK49336 Arizona 4809.216960 No Basic College \n", + "1 KX64629 California 2228.525238 No Basic College \n", + "2 LZ68649 Washington 14947.917300 No Basic Bachelor \n", + "3 XL78013 Oregon 22332.439460 Yes Extended College \n", + "4 QA50777 Oregon 9025.067525 No Premium Bachelor \n", + "\n", + " effective_to_date employmentstatus gender income ... sales_channel \\\n", + "0 2011-02-18 Employed M 48029 ... Agent \n", + "1 2011-01-18 Unemployed F 0 ... Call Center \n", + "2 2011-02-10 Employed M 22139 ... Call Center \n", + "3 2011-01-11 Employed M 49078 ... Branch \n", + "4 2011-01-17 Medical Leave F 23675 ... Branch \n", + "\n", + " total_claim_amount vehicle_class vehicle_size vehicle_type month \\\n", + "0 292.800000 Four-Door Car Medsize A 2 \n", + "1 744.924331 Four-Door Car Medsize A 1 \n", + "2 480.000000 SUV Medsize A 2 \n", + "3 484.013411 Four-Door Car Medsize A 1 \n", + "4 707.925645 Four-Door Car Medsize A 1 \n", + "\n", + " monthly_premium_auto_y revenue number_of_open_complaints_y policy_type_y \n", + "0 61.0 122.0 0 Corporate Auto \n", + "1 64.0 64.0 0 Personal Auto \n", + "2 100.0 200.0 0 Personal Auto \n", + "3 97.0 97.0 0 Corporate Auto \n", + "4 117.0 117.0 0 Personal Auto \n", + "\n", + "[5 rows x 30 columns]" + ] + }, + "execution_count": 70, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# first we need to bring in the merged_df table the values for \n", + "customer_service_df = merged_df.merge(\n", + " insurance_updated_df[[\"customer\", \"number_of_open_complaints\", \"policy_type\"]],\n", + " on=\"customer\",\n", + " how=\"inner\"\n", + ")\n", + "customer_service_df.head(5)\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "id": "2bc0acf5-e7a9-4701-9656-c6ce4728c0d5", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " month policy_type_y number_of_open_complaints_y\n", + "0 1 Corporate Auto 73\n", + "1 1 Personal Auto 363\n", + "2 1 Special Auto 15\n", + "3 2 Corporate Auto 78\n", + "4 2 Personal Auto 249\n", + "5 2 Special Auto 37\n" + ] + } + ], "source": [ - "# Your code goes here" + "complaints = customer_service_df.groupby([\"month\", \"policy_type_y\"])[\"number_of_open_complaints_y\"].sum()\n", + "complaints_long = complaints.reset_index()\n", + "print(complaints_long)\n" ] } ], @@ -146,9 +4546,9 @@ "provenance": [] }, "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python [conda env:base] *", "language": "python", - "name": "python3" + "name": "conda-base-py" }, "language_info": { "codemirror_mode": { @@ -160,7 +4560,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.13.5" } }, "nbformat": 4,