DATA ANALYTICS WITH PYTHON: credit loan case study and why I did it.

Franklin nnemeka Nwafor
3 min readAug 17, 2022

--

I was battling with the principles of object-oriented programming in python when I got an email containing a case from a company I applied to work in. I practically had no clue and even wanted to reply to the employer that I am no longer interested in continuing with the application, but the childly manifestation of curiosity made me want to try and see how far I could get, so I sluggishly crawled outside with my laptop and decided to start with the simplest things:

import pandas as pd

import NumPy as np

import matplotlib.pyplot as plt

import seaborn as sns

At this point, folks outside marvelled at the sight of the dark screen that besieged them, they were like “ wow cool! you do code! that's awesome” and some beautiful Ukrainian girl with the most amazing eyes I have ever seen started smiling at me, I mean I have been glaring, not that I am interested anyway, but she’s really pretty, I mean oh yeah she is.

well, the grand opening made me understand the power I wield. so I went on to load the datasets :

dataCredit = pd.read_csv(“../datasets/credit_applications.csv”)
dataCustomers = pd.read_csv(“../datasets/customers.csv”)

I kept acting so serious like I was about to restructure the universe, I mean I felt fire in my vain and my head was overflowing with pride as I took the position of a 20x programmer, looking to program faster than the speed of light. After a brief glance around to notice those noticing me; I went on to merge the two datasets, the credit dataset and the customer datasets:

mergedLoanRecords = pd.merge(dataCustomers, dataCredit, on=[“client_nr”], how = ‘left’)
mergedLoanRecords.head(-10)

now the data was fully ready, I decided to do a heatmap not that I needed to, it was my obsession with continually flooding my screen with reds and greens that made me do it, so i:

plt.figure(figsize=[15,7])
sns.heatmap(mergedLoanRecords.corr(), annot=True)
plt.show()

well, it was magical, everything was really colourful, some folks stopped took a peep and left which got the beautiful eyes Ukrainian girl got more curious. At this point, my heart started racing so fast that my hands started sweating.

sometimes, I would purposely run the code on my terminal just to show how cool I am, it was really a funny display of stupidity, but it was leading me on a good path.

so, i went on to calculate the mean balance for the clients that opted for the flexible balance loans:

d=mergedLoanRecords[mergedLoanRecords[‘credit_application’]==1]
d[(d[‘min_balance’]<1) & (d[‘max_balance’]<1)].describe().transpose()[[‘mean’,’50%’]]

I was not really interested in the result, I was more concerned that the codes worked and whenever it does, I put on a little drama by acting not to be dramatic, I mean you need to be the queen of drama to notice how dramatic I am.

so, at this point, I calculated the monthly revenue for the flexible balance client and that was the point I noticed how it decreases over time and also how the volume of transactions correlated with the minimum and maximum balance.

hmm.. I am pretty sure that there are more interesting facts about the dataset that I didn't notice, I was just satisfied by the credit and the fact that I am “the coding Ghost of Apeldoorn”

fell free to contact me if you wish to have a copy of the dataset to try and see what you might find.

--

--