The lowest rating is decided using the following list (/ represent a new cloumn) and is dependent upon the rating company (MR, SPR or FR). The list shows which is the lowest rate in comparison to other companies
Ratings list MR:
Aaa/Aa1,Aa2,Aa3/A1,A2,A3/Baa1,Baa2,Baa3/Ba1,Ba2,Ba3/B1,B2,B3/Caa1,Caa2,Caa3,Ca,C
SPR:
AAA/AA+,AA,AA-/A+, A, A-/BBB+,BBB,BBB-/BB+,BB,BB-/B+,B,B-/CCC+,CCC,CCC-,CC,C,D
FR:
AAA/AA+,AA,AA-/A+, A, A-/BBB+,BBB,BBB-/BB+,BB,BB-/B+,B,B-/CCC,CC,C,DDD,DD,D
As shown in the example below, if multiple companies rate a bond on the same day, the lowest must be chosen How would I select the row with the lowest letter in?
For example:
| issue_id | Rating_Date | Rating | Rating_type |
|---|---|---|---|
| 5 | 2015-12-31 | Aaa | MR |
| 5 | 2015-12-31 | BBB+ | SPR |
| 5 | 2015-12-31 | BBB- | FR |
| 5 | 2015-12-31 | C | MR |
I would be wanting the following row as my output:
| issue_id | Rating_Date | Rating | Rating_type |
|---|---|---|---|
| 5 | 2015-12-31 | C | MR |