You are on page 1of 3

Credit Risk Analysis using Python

By Erwin De Rama

The objective of Credit Risk Analysis is trying to measure the probability of default or the failure to pay
the promised loan amount. The Credit Rating is the grade or the credit worthiness of the entity or the
firm. The lower the credit rating is the higher the potential of default.

Flow of the Automation using Python

1. The Credit Rating will be read and downloaded from my Outlook inbox.
2. Save the PDF attachments
3. Convert the PDF files to txt or csv files
4. Display the Credit Rating Migration Table per unique industry of Customer
5. Zip the csv files and send the different report to different stakeholders

Below are the Python Code Excerpts, from the procedure above

Step 1-2: The Credit Rating will be read and downloaded and saved from my Outlook inbox
Step 3: After the PDF attachments are downloaded, using Python the Pdf file will be converted into text
or csv files using the sample code below:

Another way of converting PDF to Text, in case the above code doesn’t work in your system, is using
pdf2txt.py. See below screen shot.
Step 4 The Credit Migration Table can be displayed and viewed by the Credit Risk Analyst

Analysis:

According to Credit Rating Migration Matrix above, when a company has an Aaa rating this year, what is
its probability in the next five year to remain as the same credit rating? According to the above Python
screenshot, the probability that it keeps its Aaa rating next year is 89. On the other hand, there is 7%
chance that its credit rating would be downgraded by one notch, that is, from Aaa to Aa1. For a Baa1
rated bond, the probability of maintaining the same credit rating is 80%. Jointly, it has 15% probability of
upgrading. For a possible downgrade, it has 5% probability.

You might also like