成功解决 ValueError: Shape of passed values is (3, 1), indices imply (3, 3)
被这个问题影响太久了,今天一定要记录一下!
说到底,是自己学的不扎实,基本概念不牢靠,很多东西只知道用。
import pandas as pd
print(pd.DataFrame([1,2]))
print('------------------')
print(pd.DataFrame([[1,2]]))
运行结果如下:
可以看到,当是 [1,2]时,是一个列表,只有一维,相当于是:
print(pd.DataFrame([[1],[2]]))
当是 [[1,2]]时,有两个括号,算是二维:
print(pd.DataFrame([[1,2],[3,4]]))
当每个变量都是列表时,如果要达到二维的效果,就要再加一个括号:
data = pd.DataFrame([[index, uri_data_list, first_data]], columns=['index', 'uri_list', 'first_uri'])
成功解决 ValueError: Shape of passed values is (3, 1), indices imply (3, 3)相关推荐
- 成功解决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 (1, 332), indices imply (1, 1)
成功解决ValueError: Shape of passed values is (1, 332), indices imply (1, 1) 目录 解决问题 解决思路 解决方法 解决问题 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 ...
最新文章
- centos 扫毒软件clamAV安装
- 比特币再度遭遇资金“大逃离” 后市前景愈发摇摇欲坠
- zabbix企业应用之监控mysql 5.6版本
- python导入csv数据例子-使用python读取csv文件快速插入数据库的实例
- stm32超声波测距代码_干货!特斯拉Autopilot核心传感器解读超声波雷达篇
- 【Trie】最大异或对(ybtoj Trie-2)
- django-中间件
- postmapping注解_Swagger常用注解
- WORD给文档设置密码保护?
- python sizeof_python 变量作用域 v.__sizeof__() python 深复制 一切皆对象 尽量减少内存消耗 赋值语句的原理...
- systemd 与 sysVinit 彩版对照表
- ASP.NET Core DI 手动获取注入对象
- [渝粤教育] 西南科技大学 婚姻家庭继承法 在线考试复习资料
- java符号用语_java常用语
- Jenkins插件Gerrit Trigger配置,实现change-merged时自动触发Jenkins工程build
- win10 怎么由豆沙绿恢复为默认的颜色
- linux下ftp搭建流程
- pstack 安装linux_linux下的进程堆栈查看工具pstack
- 虚拟机权限不足,无法访问文件
- 别再花时间统计考勤数据了,这个报表统计神器才是你最后出路