Credit Risk Modeling
In the section of ‘Preprocessing Discrete Variables: Automating Calculations’, about the code below,
df_inputs_prepr[‘home_ownership:RENT_OTHER_NONE_ANY’] = sum([df_inputs_prepr[‘home_ownership:RENT’], df_inputs_prepr[‘home_ownershipTHER’],
df_inputs_prepr[‘home_ownership:NONE’],df_inputs_prepr[‘home_ownership:ANY’]]). Although 'rent' is one of the categories, but [‘home_ownership:RENT’] is not the column of the dataset. How come we can directly use df[‘home_ownership:RENT’]?
df_inputs_prepr[‘home_ownership:RENT_OTHER_NONE_ANY’] = sum([df_inputs_prepr[‘home_ownership:RENT’], df_inputs_prepr[‘home_ownershipTHER’],
df_inputs_prepr[‘home_ownership:NONE’],df_inputs_prepr[‘home_ownership:ANY’]]). Although 'rent' is one of the categories, but [‘home_ownership:RENT’] is not the column of the dataset. How come we can directly use df[‘home_ownership:RENT’]?
1 answers ( 0 marked as helpful)
Hi,
Could you please try to remove RENT and keep the code as:
The 365 Team
- df_inputs_prepr['home_ownership:OTHER_NONE_ANY'] = sum([ df_inputs_prepr['home_ownership:OTHER'],
- df_inputs_prepr['home_ownership:NONE'],
- df_inputs_prepr['home_ownership:ANY']])
The 365 Team