-
-
Save sazio/c92e55fb567d48be9bed812cf13aee6b to your computer and use it in GitHub Desktop.
This file contains 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
import numpy as np | |
from sklearn.impute import SimpleImputer | |
# Missing expected values are Nan, we're using statitistics (mean) to impute | |
imp_mean = SimpleImputer(missing_values=np.nan, strategy='mean') | |
X_train = [[7, 2, 3], [4, np.nan, 6], [10, 5, 9]] | |
imp_mean.fit(X_train) | |
X_test = [[np.nan, 2, 3], [4, np.nan, 6], [10, np.nan, 9]] | |
print(imp_mean.transform(X_test)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment