Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. def coarse_classer(df, indexloc_1, indexloc_2):
  2. mean_val = pd.DataFrame(np.mean(pd.DataFrame([df.iloc[indexloc_1], df.iloc[indexloc_2]]))).T
  3. original = df.drop([indexloc_1, indexloc_2])
  4.  
  5. coarsed_df = pd.concat([original, mean_val])
  6. coarsed_df = coarsed_df.sort_values(by='WoE', ascending=False).reset_index(drop=True)
  7.  
  8. return coarsed_df
  9.  
  10.  
  11. geography_df = coarse_classer(geography_df, 1, 2)
  12. geography_df
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement