1:寻找list中最大值、最小值位置
转载自:https://blog.youkuaiyun.com/fengjiexyb/article/details/77435676
c = [-10,-5,0,5,3,10,15,-20,25]
print c.index(min(c)) # 返回最小值
print c.index(max(c)) # 返回最大值
2:报错 Reshape your data either using array.reshape(-1, 1)
训练数剧维度和模型要求不一致会报这个错误,我是在讲一个特征进行训练时得到这个错误,rf模型,提示要加reshape(-1,1),最新版本要求values.reshape()
rf.fit(X_train.iloc[:, tmp_list].values.reshape(-1, 1), y_train)
3:python 打印格式话输出的时候,替换部分要加()
“%s %s” % (value1,value2)
for i,s in enumerate(feature_indexs):
print("%s %s %s