您当前的位置: 首页 > 
  • 5浏览

    0关注

    2393博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

成功解决TypeError: can‘t multiply sequence by non-int of type ‘float‘

一个处女座的程序猿 发布时间:2022-08-02 18:49:49 ,浏览量:5

成功解决TypeError: can't multiply sequence by non-int of type 'float'

目录

解决问题

解决思路

解决方法

1、分析bug

2、定位出错函数

解决问题

TypeError: can't multiply sequence by non-int of type 'float'

解决思路

类型错误:不能将序列乘以float类型的非int类型

解决方法

1、分析bug

失败运行的结果

['male' 'female' 'female' 'female' 'male' 'male' 'male' 'male' 'female'
 'female']

value_grids = np.percentile(feature_values, percentile_grids)
TypeError: can't multiply sequence by non-int of type 'float'

成功运行的结果

[1 0 0 0 1 1 1 1 0 0]

2、定位出错函数

分析函数的输入参数,分析出错参数feature,分发现该参数的规则是

feature: string or list, feature or feature list to investigate, for one-hot encoding features, feature list is required

故输入数据及数据类型,应该满足 one-hot encoding features以上条件才可以!

哈哈,大功告成!

关注
打赏
1664196048
查看更多评论
立即登录/注册

微信扫码登录

0.2457s