📜  使用 sklrean 填充缺失值 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:15.783000             🧑  作者: Mango

代码示例1
import numpy as np
from sklearn.impute import SimpleImputer
imp = SimpleImputer(missing_values=np.nan, strategy='mean')
imp.fit([[1, 2], [np.nan, 3], [7, 6]])

X = [[np.nan, 2], [6, np.nan], [7, 6]]
print(imp.transform(X))