Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def coarse_classer(df, indexloc_1, indexloc_2):
- mean_val = pd.DataFrame(np.mean(pd.DataFrame([df.iloc[indexloc_1], df.iloc[indexloc_2]]))).T
- original = df.drop([indexloc_1, indexloc_2])
- coarsed_df = pd.concat([original, mean_val])
- coarsed_df = coarsed_df.sort_values(by='WoE', ascending=False).reset_index(drop=True)
- return coarsed_df
- geography_df = coarse_classer(geography_df, 1, 2)
- geography_df
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement