Scorecard
I got a bunch of only nans in the lecture about creating a scorecard.
min_score=300
max_score=850
In [131]:
min_score
min_score=scorecard_df.groupby(['Original_names'])['Coef'].min()
min_score
Out[131]:
Original_names Intercept -1.286588 acc_now_delinq 0.000000 addr_state 0.000000 annual_inc -0.068937 dti 0.000000 emp_length 0.000000 grade 0.000000 home_ownership 0.000000 initial_list_status 0.000000 inq_last_6mths 0.000000 int_rate 0.000000 mths_since_earliest_cr_line 0.000000 mths_since_issue_d -0.060627 mths_since_last_delinq 0.000000 mths_since_last_record -0.049872 purpose 0.000000 term 0.000000 verification_status -0.010562 Name: Coef, dtype: float64In [130]: min_score_sum
min_score_sum=scorecard_df.groupby(['Original_names'])['Coef'].min().sum()
min_score_sum
Out[130]:
-1.4765851105053986In [125]: max_score
max_score=scorecard_df.groupby(['Original_names'])['Coef'].max()
max_score
Out[125]:
Original_names Intercept -1.286588 acc_now_delinq 0.235443 addr_state 0.524189 annual_inc 0.577045 dti 0.389218 emp_length 0.126174 grade 0.912940 home_ownership 0.106218 initial_list_status 0.054820 inq_last_6mths 0.694467 int_rate 0.867411 mths_since_earliest_cr_line 0.131432 mths_since_issue_d 1.091989 mths_since_last_delinq 0.239036 mths_since_last_record 0.286678 purpose 0.300414 term 0.078659 verification_status 0.084432 Name: Coef, dtype: float64In [126]: ore_sum
max_score_sum=scorecard_df.groupby(['Original_names'])['Coef'].max().sum()
max_score_sum
Out[126]:
5.413976291458666In [127]: _df
scorecard_df['Score']=scorecard_df['Coef']*(max_score-min_score)/(max_score_sum-min_score_sum)
In [132]:
scorecard_df.Score.unique()
Out[132]:
array([nan])
1 answers ( 0 marked as helpful)
Hi there,
Are you sure that you indexes are correct?
I would be easiest if you provide your notebook so we can examine it.
Best,
Iliya