For this lab, we will be using the dataset in the Customer Analysis Business Case. This dataset can be found in files_for_lab
folder.
An auto insurance company has collected some data about its customers including their demographics, education, employment, policy details, vehicle information on which insurance policy is, and claim amounts. You will help the senior management with some business questions that will help them to better understand their customers, improve their services, and improve profitability.
Some business Objectives:
- Retain customers,
- Analyze relevant customer data,
- Develop focused customer retention programs.
Based on the analysis, take targeted actions to increase profitable customer response, retention, and growth.
- Import the necessary libraries.
- Load the
we_fn_use_c_marketing_customer_value_analysis.csv
into the variablecustomer_df
. - First look at its main features (
head
,shape
,info
). - Rename the columns so they follow the PE8 (snake case).
- Change effective to date column to datetime format.
- Check
NaN
values per column. - Define a function that differentiates between continuous and discrete variables. Hint: A number of unique values might be useful. Store continuous data into a
continuous
variable and do the same fordiscrete
and categorical. - For the categorical data, check if there is some kind of text in a variable so we would need to clean it. Hint: Use the same method you used in step 7. Depending on the implementation, decide what to do with the variables you get.
- Get categorical features.
- What should we do with the
customer_id
column?