Last answered:

30 Mar 2020

Posted on:

29 Mar 2020

0

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’]?
1 answers ( 0 marked as helpful)
Instructor
Posted on:

30 Mar 2020

0
Hi, Could you please try to remove RENT and keep the code as:
  1. df_inputs_prepr['home_ownership:OTHER_NONE_ANY'] = sum([ df_inputs_prepr['home_ownership:OTHER'],
  2. df_inputs_prepr['home_ownership:NONE'],
  3. df_inputs_prepr['home_ownership:ANY']])
Best,
The 365 Team

Submit an answer