我已经调用了我想用NAs替换的train和test数据帧的特性索引:
Catlist1=['FireplaceQu','BsmtQual','BsmtExpo','BsmtCond','BsmtFinType1','GarageFinish',
'GarageType','GarageCond','GarageQual','MasVnrType']
Catlist2=['FireplaceQu','BsmtQual','BsmtExpo','BsmtCond','BsmtFinType1','GarageFinish',
'GarageType','GarageCond','GarageQual','MasVnrType']
要替换我调用的NAs:
for i in Catlist1:
train_df.ix[pd.isnull(train_df[:,i]),i]=np.nanmedian(train_df.ix[:,i])
for i in Catlist2:
test_df.ix[pd.isnull(test_df[:,i]),i]=np.nanmedian(test_df.ix[:,i])
我收到了错误信息:
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
我不确定我是否理解此错误消息以及我可能在这里做错了什么。谢谢您!你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐