Created
September 9, 2019 13:46
-
-
Save dradecic/564c3a9de955ef972b74575f2b700920 to your computer and use it in GitHub Desktop.
ara_4_coarse_classing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment