You are provided with the following data: loan_data.csv
This is the historical data that the bank has provided. It has the following columns
Application Attributes:
years
: Number of years the applicant has been employed ownership
: Whether the applicant owns a house or not income
: Annual income of the applicant age
: Age of the applicant Behavioural Attributes:
grade
: Credit grade of the applicantOutcome Variable:
amount
: Amount of Loan provided to the applicant interest
: Interest rate charged for the applicant default
: Whether the applicant has defaulted or not Let us build some intuition around the Loan Data
In [ ]:
In [4]:
#Load the libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
In [5]:
#Default Variables
%matplotlib inline
plt.rcParams['figure.figsize'] = (16,9)
plt.rcParams['font.size'] = 18
plt.style.use('fivethirtyeight')
pd.set_option('display.float_format', lambda x: '%.2f' % x)
In [6]:
#Load the dataset
df = pd.read_csv("data/loan_data_clean.csv")
In [7]:
df.head()
Out[7]:
In [1]:
# Create a crosstab of default and grade
In [2]:
# Create a crosstab of default and grade - percentage by default type
In [3]:
# Create a crosstab of default and grade - percentage by all type
In [4]:
# Create a crosstab of default and grade - percentage by default type
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [17]:
# Create the transformed income variable
In [ ]:
In [5]:
#Plot age, years and default
In [ ]:
In [ ]:
In [ ]:
In [ ]: