sklearn中TypeError: reduction operation argmax not allowed for this dtype idmax报错解决方案
在网上学习的时候遇到了这个问题
造成如上报错的原因,可能是参数类型不支持,如对象是NAN时就会报错。
解决方法是对对象进行类型转换:
best_c=results_table.loc[results_table[‘Mean recall score’].astype(float).idxmax()][‘C_parameter’]
将上述NAN值转换成float类型,即可解决报错问题。