IntermediateFinancePYTHON+20 XP

Credit scoring: engineer a debt ratio feature

Scenario

You are a data scientist. Raw income and debt columns barely predict default. Credit risk analysts always reason in ratios, not absolutes.

Question

Make one useful clue called debt_to_income by dividing debt by income, while safely handling zero income.

Intermediate · Data Filtering & Record Counting — question 1 of 30

Finish all 30 to earn a certificate

1. Choose your dataset

Pick an industry and a size. Your code and results change to match.

📓 DataPro notebookds-fin-01.ipynbFileEditViewRunKernel: Python 3
[md]

Credit scoring: engineer a debt ratio feature

Make one useful clue called debt_to_income by dividing debt by income, while safely handling zero income.

In [1]:

Your code cell is below. Press Check my answer to run the cell — the result appears as Out [1].

python editor
Type your code here ↓
✍️ Tap here to type

Dataset & schema

loan_applications

The tiny starter data. Bigger data scrolls.

Fields

applicant_idmonthly_incomemonthly_debtdefaulted
12400060000
2032001
318500148001
attempts: 0
▶ Output terminal
$ Press “Check my answer” — results appear here.

Your next steps

Each item turns green when your answer includes it.

4 left
  • Creates the ratio
  • Guards divide-by-zero
  • Finds the 99th percentile
  • Caps the values