from sklearn import preprocessing
import numpy as np
X = [[1, 2], [np.nan, 4], [2, 6]]
y = [[np.nan, 4], [1, 3], [2, 4]]
imp = preprocessing.Imputer(missing_values=‘Nan‘, strategy=‘mean‘)
imp.fit(X)
print(imp.transform(X))
print(imp.transform(y))
原文地址:http://blog.51cto.com/14008737/2296042
时间: 2024-10-21 06:22:10