-
-
Save tcvieira/79734b36a1cf4ec581eb445f30f86c69 to your computer and use it in GitHub Desktop.
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
# Filling in NaN values of a particular feature variable | |
avg_height = 67 # Maybe this is a good number | |
data["height"] = data["height"].fillna(avg_height) | |
# Filling in NaN values with a calculated one | |
avg_height = data["height"].median() # This is probably more accurate | |
data["height"] = data["height"].fillna(avg_height) | |
# Dropping rows with missing values | |
# Here we check which rows of "height" aren't null | |
# and only keep those | |
data = data[pd.notnull(data['height'])] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment