Created
January 22, 2024 08:20
-
-
Save wibowotangara/f6e490bff6e0041e8d9bbd6c892d52bc to your computer and use it in GitHub Desktop.
This file contains 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
categorical_columns = ['emp_length'] | |
numerical_columns = ['revol_util','collections_12_mths_ex_med','inq_last_6mths','acc_now_delinq','delinq_2yrs','total_acc', | |
'pub_rec','annual_inc'] | |
for col in categorical_columns: | |
mode_value = df[col].mode()[0] | |
df[col].fillna(mode_value, inplace=True) | |
for col in numerical_columns: | |
median_value = df[col].median() | |
df[col].fillna(median_value, inplace=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment