第一列包含名称,第二列包含值。 我怎么能用bokeh来绘制呢。下面是在matlabplot中绘制的代码
new_rf = pd.Series(rf.feature_importances_,index=x.columns).sort_values(ascending=False)
new_rf[:5]
这样x将取变量名,y将取值
p =figure()
p.vbar(
x = new_rf[:5].index, #here will be the feature name
top = new_rf[:5].values, #here will be feature_importance weight
)
这只是给了我一个空洞的情节
代码问题:
new_rf
,但使用imp_feat_rf
。我想这只是部分重命名时复制代码到所以vbar()
需要width
参数。当您运行代码时,应该在Python输出中看到这个错误x_range
参数接受列表,但不接受索引,因此必须将索引转换为列表相关问题 更多 >
编程相关推荐