Created
March 26, 2020 10:44
-
-
Save FelixChop/e7ca8f3253a03d0e4bfe7170af92ffd4 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
transformed_age = \ | |
pd.DataFrame(imputer_age.transform(train[['Age']]), | |
columns=['Age', 'Age_missing'], | |
index=train.index) # the most important line: do not forget the index | |
train = train.drop(columns=['Age']).join(transformed_age) | |
transformed_age = \ | |
pd.DataFrame(imputer_age.transform(validation[['Age']]), | |
columns=['Age', 'Age_missing'], | |
index=validation.index) # the most important line: do not forget the index | |
validation = validation.drop(columns=['Age']).join(transformed_age) | |
transformed_age = \ | |
pd.DataFrame(imputer_age.transform(holdout[['Age']]), | |
columns=['Age', 'Age_missing'], | |
index=holdout.index) # the most important line: do not forget the index | |
holdout = holdout.drop(columns=['Age']).join(transformed_age) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment