diff --git a/lab-dw-aggregating.ipynb b/lab-dw-aggregating.ipynb index fadd718..0b0a9e1 100644 --- a/lab-dw-aggregating.ipynb +++ b/lab-dw-aggregating.ipynb @@ -115,6 +115,35 @@ "Hint: You can use melt to unpivot the data and create a table that shows the customer response rate (those who responded \"Yes\") by marketing channel." ] }, + { + "cell_type": "code", + "execution_count": 32, + "id": "509e3e33", + "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'],\n", + " dtype='object')" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df.columns" + ] + }, { "cell_type": "markdown", "id": "e4378d94-48fb-4850-a802-b1bc8f427b2d", @@ -132,10 +161,235 @@ "metadata": { "id": "449513f4-0459-46a0-a18d-9398d974c9ad" }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Unnamed: 0 Customer State Customer Lifetime Value Response \\\n", + "3 3 XL78013 Oregon 22332.439460 Yes \n", + "8 8 FM55990 California 5989.773931 Yes \n", + "15 15 CW49887 California 4626.801093 Yes \n", + "19 19 NJ54277 California 3746.751625 Yes \n", + "27 27 MQ68407 Oregon 4376.363592 Yes \n", + "... ... ... ... ... ... \n", + "10844 10844 FM31768 Arizona 5979.724161 Yes \n", + "10852 10852 KZ80424 Washington 8382.478392 Yes \n", + "10872 10872 XT67997 California 5979.724161 Yes \n", + "10887 10887 BY78730 Oregon 8879.790017 Yes \n", + "10897 10897 MM70762 Arizona 9075.768214 Yes \n", + "\n", + " Coverage Education Effective To Date EmploymentStatus \\\n", + "3 Extended College 1/11/11 Employed \n", + "8 Premium College 1/19/11 Employed \n", + "15 Basic Master 1/16/11 Employed \n", + "19 Extended College 2/26/11 Employed \n", + "27 Premium Bachelor 2/28/11 Employed \n", + "... ... ... ... ... \n", + "10844 Extended High School or Below 2/7/11 Employed \n", + "10852 Basic Bachelor 1/27/11 Employed \n", + "10872 Extended High School or Below 2/7/11 Employed \n", + "10887 Basic High School or Below 2/3/11 Employed \n", + "10897 Basic Master 1/26/11 Employed \n", + "\n", + " Gender ... Number of Open Complaints Number of Policies \\\n", + "3 M ... 0.0 2 \n", + "8 M ... 0.0 1 \n", + "15 F ... 0.0 1 \n", + "19 F ... 1.0 1 \n", + "27 F ... 0.0 1 \n", + "... ... ... ... ... \n", + "10844 F ... 0.0 3 \n", + "10852 M ... 0.0 2 \n", + "10872 F ... 0.0 3 \n", + "10887 F ... 0.0 7 \n", + "10897 M ... 0.0 8 \n", + "\n", + " Policy Type Policy Renew Offer Type Sales Channel \\\n", + "3 Corporate Auto Corporate L3 Offer2 Branch \n", + "8 Personal Auto Personal L1 Offer2 Branch \n", + "15 Special Auto Special L1 Offer2 Branch \n", + "19 Personal Auto Personal L2 Offer2 Call Center \n", + "27 Personal Auto Personal L3 Offer2 Agent \n", + "... ... ... ... ... \n", + "10844 Personal Auto Personal L1 Offer2 Agent \n", + "10852 Personal Auto Personal L2 Offer2 Call Center \n", + "10872 Personal Auto Personal L3 Offer2 Agent \n", + "10887 Special Auto Special L2 Offer1 Agent \n", + "10897 Personal Auto Personal L1 Offer1 Agent \n", + "\n", + " Total Claim Amount Vehicle Class Vehicle Size Vehicle Type \n", + "3 484.013411 Four-Door Car Medsize A \n", + "8 739.200000 Sports Car Medsize NaN \n", + "15 547.200000 SUV Medsize NaN \n", + "19 19.575683 Two-Door Car Large A \n", + "27 60.036683 Four-Door Car Medsize NaN \n", + "... ... ... ... ... \n", + "10844 547.200000 Four-Door Car Medsize NaN \n", + "10852 791.878042 NaN NaN A \n", + "10872 547.200000 Four-Door Car Medsize NaN \n", + "10887 528.200860 SUV Small A \n", + "10897 158.077504 Sports Car Medsize A \n", + "\n", + "[1399 rows x 26 columns]\n" + ] + }, + { + "data": { + "text/html": [ + "
\n", + " | Education | \n", + "Gender | \n", + "Max CLV | \n", + "Min CLV | \n", + "Median CLV | \n", + "
---|---|---|---|---|---|
0 | \n", + "Bachelor | \n", + "F | \n", + "73225.95652 | \n", + "1904.000852 | \n", + "5640.505303 | \n", + "
1 | \n", + "Bachelor | \n", + "M | \n", + "67907.27050 | \n", + "1898.007675 | \n", + "5548.031892 | \n", + "
2 | \n", + "College | \n", + "F | \n", + "61850.18803 | \n", + "1898.683686 | \n", + "5623.611187 | \n", + "
3 | \n", + "College | \n", + "M | \n", + "61134.68307 | \n", + "1918.119700 | \n", + "6005.847375 | \n", + "
4 | \n", + "Doctor | \n", + "F | \n", + "44856.11397 | \n", + "2395.570000 | \n", + "5332.462694 | \n", + "