成功解决ValueError: Shape of passed values is (1, 332), indices imply (1, 1)
成功解决ValueError: Shape of passed values is (1, 332), indices imply (1, 1)
目录
解决问题
解决思路
解决方法
解决问题
ValueError: Shape of passed values is (1, 332), indices imply (1, 1)
def XGBR_train(X, y):train_x, test_x, train_y, test_y = train_test_split(X, y, test_size=0.3, random_state=0) test_preds = pd.DataFrame({"label": test_y}, index=[1,332])XGBR_model = XGBRegressor(learning_rate=0.03, # 默认0.3n_estimators=100, # 树的个数max_depth=4 )XGBR_model.fit(train_x, train_y)test_preds['y_pred'] = XGBR_model.predict(test_x)XGBR_model_score = metrics.r2_score(test_preds['label'], test_preds['y_pred'])# GridSearchCV和cross_val_score的结果一样
# scores = cross_val_score(XGBR_model, X, y, scoring='r2')
# print(scores)
# gs = GridSearchCV(XGBR_model, {}, cv=3, verbose=3).fit(X, y)return XGBR_model, XGBR_model_score
解决思路
值错误:传递值的形状为(1,332),索引表示(1,1)
解决方法
可知,形状为一维数据,所以索引只能在数据的维数范围内,不可超出!
成功解决ValueError: Shape of passed values is (1, 332), indices imply (1, 1)相关推荐
- 成功解决ValueError: Shape of passed values is (33, 1), indices imply (33, 2)
成功解决ValueError: Shape of passed values is (33, 1), indices imply (33, 2) 目录 解决问题 解决思路 解决方法 解决问题 Valu ...
- 成功解决 ValueError: Shape of passed values is (2, 3), indices imply (4, 3)
昨天整理了知识点,今天复盘时,发现了error,巩固dataframe的用法. 错误原因 file3 = pd.DataFrame(data = {'Gender':['M','F'],'Height ...
- 已解决ValueError: Shape of passed values is (1509, 1), indices imply (1509, 2)
已解决(pandas创建DataFrame对象失败)ValueError: Shape of passed values is (1509, 1), indices imply (1509, 2) 文 ...
- 已解决ValueError: Shape of passed values is (6, 3), indices imply (4, 3)
已解决(pd.concat连接错误)ValueError: Shape of passed values is (6, 3), indices imply (4, 3) 文章目录 报错代码 报错翻译 ...
- ValueError: Shape of passed values is (10, 10000), indices imply (3, 10000)
ValueError: Shape of passed values is (10, 10000), indices imply (3, 10000) 错误原因是: 维度保持不一致,原来是(10,10 ...
- Value Error:Shape of passed values is (2, 3), indices imply (3, 2)
Pandas库已导入,拟通过pd.DataFrame导入Panel data. 出现报错:ValueError: Shape of passed values is (2, 3), indices i ...
- 成功解决Shape of passed values is (962, 1201), indices imply (3420, 1201)
# data1 = pd.DataFrame(data1) # data1 = data1.values new_data = np.delete(data1, [0, 1], axis=0) # a ...
- Shape of passed values is (230999, 1), indices imply (230999, 3)
起因 使用pandas报错 serires = pd.Series(counter) serires.sort_values(ascending=False, inplace=True) df = p ...
- 解决ValueError: Shape of passed values is (1,5), indices imply (1,3)
报错部分代码: MetricsDataFrame = pd.DataFrame(Metrics,columns=np.tile(MetricNames, datasetNum),index=exper ...
最新文章
- linux后台运行和关闭、查看后台任务
- json文件中的双引号隐藏
- 两个js文件同时执行,解决覆盖问题
- Coursera吴恩达《卷积神经网络》课程笔记(4)-- 人脸识别与神经风格迁移
- SQL Server 排序规则(摘)
- linux blind函数,C++拾遗--bind函数绑定
- docker下载出现异常 dial tcp: lookup ngc.download.nvidia.cn: no such host
- mysql忘记密码时如何修改root用户密码
- PHP中的数组(拆分与合并)
- Code[VS]1273 风战
- 图像去噪序列——BM3D图像去噪模型实现
- 看了这个教程,学会快速找出三等分点
- python关键词排名批量查排名_Python批量查询百度排名
- 微信支付普通商户模式实现分账操作
- 80句经典英文电影台词,英语作文最佳素材
- 司普沃浅谈豆角种植技术与管理方案
- 从线上卖到线下,秘籍在这里|千牛头条双11直播
- 【解决】敬业签Windows电脑桌面便签软件安装不能打开要写入的文件问题造成桌面便签软件安装失败的解决办法
- 【Gulimall+】第三方服务:对象存储OSS、短信验证、社交登录、支付宝支付
- java制作坦克大战
热门文章
- 河北工业机器人夹爪生产厂家_电动夹爪会成为“标配”吗?
- libsvm2.9数据格式
- IE浏览器导出问题。。好要命
- 用Linux虚拟机手工编译安装Apache
- ios 带scrollView的控制器,双击“状态栏”,返回scrollView的顶部
- 从源码编译InfluxDB
- C#开发微信门户及应用(21)-微信企业号的消息和事件的接收处理及解密
- 11岁美国男孩用玩具熊“黑”了国际网络安全大会
- 动态asp网页批量生成静态html网页问题
- 解决了无法显示验证码的问题