Ivy Professional School
Rating
Learning/Python Data Drill #5

Bank Loan Risk Analysis

Last updated

Analyze loan applicants and classify financial risk, loan eligibility, and income-group summary metrics.

PythonIntermediatePandasNumPyRisk AnalysisLambdaGroupBy

Your Objective

Analyze loan applicants and classify financial risk, loan eligibility, and income-group summary metrics.

The Setup

Your dataset contains loan_applications with applicant income, loan amount, credit score, and existing EMI.

Table Schema

loan_applications
ColumnTypeKey / Notes
applicant_idINTUnique applicant ID
applicant_nameVARCHAR(50)Applicant name
ageINTApplicant age
monthly_incomeFLOATMonthly income of applicant
loan_amountFLOATRequested loan amount
credit_scoreINTApplicant credit score
existing_emiFLOATExisting monthly EMI amount

Sample Data

loan_applications — 8 rows

applicant_idapplicant_nameagemonthly_incomeloan_amountcredit_scoreexisting_emi
201Ramesh326500080000076012000
202Sneha28480006000006909000
203Arjun4190000150000081025000
204Nisha355500070000062018000
205Karan45120000200000078030000
206Pooja26380005000006407000
207Manav397500095000071016000
208Riya31520004000007308000

Your Task

Calculate EMI-to-income percentage and loan-to-income ratio. Assign risk category using credit score and EMI burden. Identify whether the applicant is loan eligible. Create income groups and summarize average loan amount by income group.

Your output should look like this (partial example):

applicant_idapplicant_nameemi_to_income_pctloan_to_income_ratiorisk_categoryloan_eligibilityincome_group
201Ramesh18.461.03Low RiskEligibleMiddle Income
202Sneha18.751.04Medium RiskEligibleLow Income
.....................

Python Hint

  • →Use np.select for risk categories, then a custom function for income_group.
Explore Enterprise Solutions