roll_rate_analysis package
Module contents
roll_rate_analysis.mom_roll_rate_table module
- class roll_rate_analysis.mom_roll_rate_table.MOMRollRateTable(unique_key_col: str, delinquency_col: str, path_i: str, path_i_1: str, max_delq: int = 6, binary_cols: list[str] = [])[source]
Bases:
object
Month Over Month Roll Rate Table of two consecutive months. Given a file that represents month i and another one that represents month i+1 this class computes the month over moth roll rate.
Parameters
- unique_key_col: str,
Unique key column of the two files. The name of the column in the two files must be the same.
- delinquency_col: str,
Column which indicates the delinquency of an account. The name of the column in the two files must be the same.
- path_i: str,
Path of the file that represents month i.
- path_i_1: str
Path of the file that represents month i+1.
- max_delq: int,
Maximum value of delinquency we want in the table. Every other value for delinquency greater than max_delq is summarized and added into this one.
- binary_cols: list[str],
List of binary columns that you want to inlude in the roll rate table. They have priority over delinquency. Also, if the binary_cols are more than one, they must be added in the list in descinding priority order.
roll_rate_analysis.snapshot_roll_rate_table module
- class roll_rate_analysis.snapshot_roll_rate_table.SnapshotRollRateTable(snapshot_file: str, unique_key_col: str, delinquency_col: str, obs_files: list[str], perf_files: list[str], keep_cols: list[str] | None = None, max_delq: int = 6, detailed: bool = False, granularity: int = 1)[source]
Bases:
object
Snapshot Roll Rate Table: Given a list of files as an observation window and another list fo files as a performance window, a roll rate table is calculated for tha accounts of the snapshot month. By default, max delinquency is measured in both windows.
Parameters
- snapshot_file: str
Path to the file referring to the snapshot month.
- unique_key_col: str
Unique key column of the files. The name of the unique_key_col should be the same in all files used.
- delinquency_col: str
Column which indicates the delinquency of an account in months. The name of the delinquency_col should be the same in all files used.
- obs_files: str
List of file paths referring to observation window months.
- perf_files: str
List of file paths referring to performance window months.
- keep_cols: str, optional
List of columns to be kept. In general, one might not need every column of the file for the calculation, so by keeping the ones needed the process is more efficient and faster.
- max_delq: int
Maximum value of delinquency we want in the table. Every other value for delinquency greater than max_delq is summarized and added into this one.
- detailed: bool
Boolean variable indicating whether or not the table should be more detailed. The detailed view concerns delinquencies equal to 3 and 4.
- granularity: int
The level of granularity was want to see in our final more detailed table. The value must be greater or equal to 2 when detailed=True.
- build()[source]
Merges the relevant data into one dataset in order to proceed with the computation afterwards.