ValueError: cannot set a row with mismatched columns Pandas报错,超级折磨人
遇到了个很麻烦的问题,百度基本上没找到解决方案,所以来记录一下。
第一步是从另外一个DataFrame中摘取了一行保存为一个新的DataFrame命名为submit,
第二步时想将oof_test保存为submit的一列,出现报错
ValueError: cannot set a row with mismatched columns Pandas
解决方案:
# 首先丢弃index,因为如果index不同的话,虽然仍然是列拼接,但会在不同的行
submit = test[['日期']]
submit = submit.reset_index()
submit.drop('index', axis=1, inplace=True)# 将另外一个要拼接的列也转为DATa Frame格式,再使用concattemp = pd.DataFrame(oof_test)
submit = pd.concat([submit,temp],axis=1)
ValueError: cannot set a row with mismatched columns Pandas报错,超级折磨人相关推荐
- cannot set a row with mismatched columns
错误:cannot set a row with mismatched columns 错误背景 原错误情况 错误原因 解决方法 错误背景 在希望将dataframe a 中的特定行移至datafra ...
- ValueError: invalid literal for int() with base 10:Python报错及其解决办法
https://blog.csdn.net/hanhanwanghaha宝藏女孩 欢迎您的关注! 欢迎关注微信公众号:宝藏女孩的成长日记 如有转载,请注明出处(如不注明,盗者必究) 报错情况 Valu ...
- 【Spark报错】CDH的spark无法读取字段中含有特殊字符“-“的orc表mismatched input ‘-‘ expecting ‘:‘
背景故事 先看报错信息: mismatched input '-' expecting ':' 报错的意思就是说,在这个表里面,字段名中存在特殊符号"-",无法解析报错. 这个问题 ...
- tensorboard报错:ValueError Duplicate plugins for name projector 问题的出现及解决过程
tensorboard报错:ValueError: Duplicate plugins for name projector 问题的出现及解决过程 记录如题问题的出现及解决过程. 报错命令及信息 笔者 ...
- 报错解决——ValueError: row index was 65536, not allowed by .xls format
报错解决--ValueError: row index was 65536, not allowed by .xls format 一.原因分析 二.解决方案 1.方法一 2.方法二 一.原因分析 x ...
- 报错ValueError: row index was 65536, not allowed by .xls format
情况: 读取.xls文件正常,在写.xls文件,pd.to_excel()时候会报错 报错: ValueError: row index was 65536, not allowed by .xls ...
- mysql text 最大长度 报错 Row size too large. The maximum row size for the used table type
数据类型长度如下 TINYTEXT 256 bytes TEXT 65,535 bytes ~64kb MEDIUMTEXT 16,777,215 bytes ~16MB LONGTEXT 4, ...
- mysql err 1118_MySQL ERROR1118报错详解 Row size too large
ERROR1118的报错信息分为两种: 1.ERROR 1118 (42000): Row size too large. The maximum row size for the used tabl ...
- dataframe 添加列表到一个单元格并解决报错ValueError: Must have equal len keys and value when setting with an...
报错解析 import pandas as pd import numpy as npdf = pd.DataFrame(np.random.randint(0,10,size=(5, 2)),col ...
最新文章
- JS中的 generator
- solrj 使用记录 - 添加文档
- matlab中线性规划优化计算方法和实例
- 从最新财报中,我看到京东“四面楚歌”
- 苹果手机声音突然变小是怎么回事_苹果7通话声音小,苹果7听筒声音小怎么回事...
- 鸿蒙和安卓,到底有什么区别?
- 面试官问:跨域请求如何携带cookie?
- python 创建类_python 用type()创建类
- Python笔记-使用sqlalchemy根据类创建数据库表
- Linux(debian7)操作基础(十四)之文本搜索命令grep使用方法
- 反向算法_10分钟带你了解神经网络基础:反向传播算法详解
- 安卓手机管理_安卓手机:管理工具
- HDU-5718 Oracle
- ECS之System系统
- 常见方案 目录 1. 发现目前 WEB 上主流的视频直播方案有 HLS 和 RTMP,	1 2. 实现直播的方法有很多,但是常用的,就这几个。 3个直播协议:rtmp、rtsp、hls。 和三个端:
- 快速构建Windows 8风格应用9-竖直视图
- C语言计算器代码(带有报告)
- hdu 5455 Fang Fang
- 情感分类——Attention(前篇续)
- 个人申请微信支付接口教程(免签约支付)