Professional Documents
Culture Documents
The dataset contains Loan data for various borrowers in a loan portfolio
Bounce String
• This is a string that explain’s customer’s bounce behaviour since the disbursal of the loan
- bounce means that the customer did not end up making the payment
• S or H- No bounce in that month
• B or L - Bounce in that month
• FEMI - first EMI - no known behaviour
• Last character denotes the last month - first character denotes the first month on book -
for example SSB means that customer was on book for 3 months and he has bounced the
in the last month
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
import os
df = pd.read_csv(r"C:\Users\Mohit\Downloads\
Data_Analyst_Assignment_Dataset.csv")
df.head()
df.shape
(24582, 8)
df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 24582 entries, 0 to 24581
Data columns (total 8 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Amount Pending 24582 non-null int64
1 State 24582 non-null object
2 Tenure 24582 non-null int64
3 Interest Rate 24582 non-null float64
4 City 24582 non-null object
5 Bounce String 24582 non-null object
6 Disbursed Amount 24582 non-null int64
7 Loan Number 24582 non-null object
dtypes: float64(1), int64(3), object(4)
memory usage: 1.5+ MB
df.columns
df.describe(include='all')
df.isnull().sum()
Amount Pending 0
State 0
Tenure 0
Interest Rate 0
City 0
Bounce String 0
Disbursed Amount 0
Loan Number 0
dtype: int64
df.skew(numeric_only=True)
condition2['Bounce String'].unique()
condition3['Bounce String'].unique()
conditions = [
condition1,
condition2,
condition3,
condition4
]
<Axes: >
df['Months on Book'] = df['Bounce String'].str.len()
df
Months on Book
0 3
1 3
2 3
3 3
4 3
... ...
24577 4
24578 4
24579 4
24580 4
24581 4
conditions = [
Cond1,
Cond2,
Cond3 ]
<Axes: >
Task 3: Segmenting borrowers based on ticket size
# Sort the DataFrame by 'Amount Pending'
df = df.sort_values(by='Amount Pending').reset_index(drop=True)
df.head()
Channel
0 Whatsapp bot
1 Whatsapp bot
2 Whatsapp bot
3 Whatsapp bot
4 Whatsapp bot
... ...
24577 Voice bot
24578 Whatsapp bot
24579 Whatsapp bot
24580 Whatsapp bot
24581 Whatsapp bot