Skip to content

Instantly share code, notes, and snippets.

@merishnaSuwal
Created November 9, 2020 03:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save merishnaSuwal/e5660528d8adf0a59fcb511a8686ee2b to your computer and use it in GitHub Desktop.
Save merishnaSuwal/e5660528d8adf0a59fcb511a8686ee2b to your computer and use it in GitHub Desktop.
# Replacing null values by mean
dataset['Age'].fillna(dataset['Age'].mean(), inplace = True)
dataset['T4U'].fillna(dataset['T4U'].mean(), inplace = True)
# Replacing null values by median
dataset['TSH'].fillna(dataset['TSH'].mean(), inplace = True)
dataset['T3'].fillna(dataset['T3'].median(), inplace = True)
dataset['TT4'].fillna(dataset['TT4'].median(), inplace = True)
dataset['FTI'].fillna(dataset['FTI'].median(), inplace = True)
# The gender data looks to be imbalanced with 0 lesser than 1
# Replacing null values with 0
dataset['Gender'].fillna(0, inplace = True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment