Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wibowotangara/f6e490bff6e0041e8d9bbd6c892d52bc to your computer and use it in GitHub Desktop.
Save wibowotangara/f6e490bff6e0041e8d9bbd6c892d52bc to your computer and use it in GitHub Desktop.
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