Created
January 19, 2024 09:08
-
-
Save wibowotangara/a71fb02df441b41b2f56e187445c2809 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
conditions = [ | |
(df['loan_status'].isin(['Fully Paid', 'Does not meet the credit policy. Status:Fully Paid'])), | |
(df['loan_status'].isin(['Charged Off', 'Late (31-120 days)', 'In Grace Period', 'Late (16-30 days)', | |
'Default', 'Does not meet the credit policy. Status:Charged Off'])) | |
] | |
values = ['good','bad'] | |
df['loan_label'] = np.select(conditions, values, default='Unknown') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment