2017-10-16 144 views
0

索引数组此代码是在我的书布尔指数不匹配沿尺寸

rlr.get_support() 
print(u'有效特征为:%s' % ','.join(data.columns[rlr.get_support()])) 

我得到了错误

IndexError: boolean index did not match indexed array along dimension 0;dimension is 9 but corresponding boolean dimension is 8 
the rlr.get_support() index is 8 and data.colunms is 9 

这是因为我的Python是Python的3.5?

回答

1

不,这不是因为Python版本。这是因为data.columns[...]需要一个相同大小的数组,用作掩码(True掩码中的值将包括来自data.columns的那个元素,False的值将会跳过它)。

不可能提供更多关于您提供的信息量的详细信息。

+0

非常感谢 – hugo