Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 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'])]
Add Comment
Please, Sign In to add comment