Project 2 - EDA on Vehicle Insurance Customer Data
1.a Add thecolumn names to the both datasets
In[] import pandas as pd
import numpy as np
In[] customer_details=pd.read_csv('customer_details.csv')
i. Column Name for customer details table:
In[] customer_details.rename ({'0':'Customer_Id','1':'Gender','2':'Age','3':'Driving Licence Present','4':'Region Code','5':'Previously Insured','6':'Vehicle Age','7':'Vehicle Damage'},axis=1,inplace=True)
In[] customer_details.head()
ii. Column Name for customer_policy table:
In[] customer_policy_details.rename({'0':'Customer_Id','1':'Annual Premium(Rs)','2':'Sales Channel Code','3':'Vintage','4':'Response'},axis=1,inplace=True)
2. Checking and Cleaning Data Quality:
i. Null values
Generate a summary of count of all the null values column wise
In[] customer_details.isna().sum()
In[] customer_policy_details.isna().sum()
Drop Null values for customer_id because central tendencies for id’s is not feasible.
In[] customer_details=customer_details.dropna(subset=['Customer_Id'])
In[] customer_details.isna().sum()
In[] customer_policy_details=customer_policy_details.dropna(subset=['Customer_Id'])
In[] customer_policy_details.isna().sum()
Replace all null values for numeric columns by mean.
In[] customer_policy_details.fillna(customer_policy_details.mean().mean(),inplace=True)
vi. Drop Duplicates (duplicated rows)
3. Create a Master table for future use. Join the customer table and customer_policy table to get a master table using customer_id in both tables.
(Hint: use pd.merge() function)
In[] master_table=pd.merge(customer_details,customer_policy_details)
i. Gender wise average annual premium
ii. Age wise average annual premium
iii. Is your data balanced between the genders?
iv. Vehicle age wise average annual premium.
5. Is there any relation between Person Age and annual premium
In[] Correlation coefficient < -0.5 - Strong negative relationship
Correlation coefficient > 0.5 - Strong positive relationship
0.5 < Correlation coefficient < 0.5 - There is no relationship.
In[] np.corrcoef(master_table['Age'],master_table['Annual Premium(Rs)'])