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

    0关注

    2393博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

成功解决IndexError: index 14 is out of bounds for axis 1 with size 14

一个处女座的程序猿 发布时间:2019-01-31 17:55:24 ,浏览量:0

成功解决IndexError: index 14 is out of bounds for axis 1 with size 14

 

 

目录

解决问题

解决思路

解决方法

 

 

 

解决问题

IndexError: index 14 is out of bounds for axis 1 with size 14

 

解决思路

索引错误:索引14超出轴1的界限,大小为14

 

解决方法

       自定义的列表混淆,向上查找正确的自定义参数!参数是df_test_5而不是最最上边定义的df_test参数,因为两者的shape不一样,所以会导致索引错误!

test = df_test.filter(regex='Age_.*|SibSp|Parch|Fare_.*|Cabin_.*|Embarked_.*|Sex_.*|Pclass.*|Mother|Child|Family|Title')
    
print('开始输出predictions')
predictions = bagging_clf.predict(test)


改为



test = df_test_5.filter(regex='Age_.*|SibSp|Parch|Fare_.*|Cabin_.*|Embarked_.*|Sex_.*|Pclass.*|Mother|Child|Family|Title')
    
print('开始输出predictions')
predictions = bagging_clf.predict(test)

 

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

微信扫码登录

0.0897s