__init__() got an unexpected keyword argument ‘axis‘
错误代码:正确导入了Imputer函数之后仍然存在问题。函数的导入:https://blog.csdn.net/weixin_43582443/article/details/111143061修改代码imr = Imputer(missing_values='NaN', strategy='mean', axis=0)为:imr = Imputer(missing_values=np.nan,
错误代码:
正确导入了Imputer函数之后仍然存在问题。
函数的导入:https://blog.csdn.net/weixin_43582443/article/details/111143061
修改代码imr = Imputer(missing_values='NaN', strategy='mean', axis=0)
为:
imr = Imputer(missing_values=np.nan, strategy='mean')
运行成功。
Imputer函数和新的SimpleImputer函数存在区别:
imp=SimpleImputer(missing_values=np.nan,strategy=’mean’)
class sklearn.preprocessing.Imputer(missing_values=’NaN’, strategy=’mean’, axis=0, verbose=0, copy=True)
Imputer的参数:
missing_values: integer or “NaN”, optional (default=”NaN”)
strategy : string, optional (default=”mean”)
The imputation strategy.
If “mean”, then replace missing values using the mean along the axis. 使用平均值代替
If “median”, then replace missing values using the median along the axis.使用中值代替
If “most_frequent”, then replace missing using the most frequent value along the axis.使用众数代替,也就是出现次数最多的数
axis: 默认为 axis=0
axis = 0, 按列处理
aixs =1 , 按行处理
参考教程:https://blog.csdn.net/dss_dssssd/article/details/82831240
更多推荐
所有评论(0)