ValueError: setting an array element with a sequence.
http://blog.csdn.net/pipisorry/article/details/48031035
From the code you showed us, the only thing we can tell is that you trying to create an array from a list that isn't shaped like a multi-dimensional array. For example
numpy.array([[1,2], [2, 3, 4]])
or
numpy.array([[1,2], [2, [3, 4]]])
will yield this error message, because the shape of the input list isn't a (generalised) "box" that can be turned into a multidimensional array. So probably UnFilteredDuringExSummaryOfMeansArraycontains
sequences of different lengths.
Edit: Another possible cause for this error message is trying to use a string as an element in an array of type float:
numpy.array([1.2, "abc"], dtype=float)
That is what you are trying according to your edit. If you really want to have a NumPy array containing both strings and floats, you could use the dtype object,
which enables the array to hold arbitrary Python objects:
numpy.array([1.2, "abc"], dtype=object)
Without knowing what your code shall accomplish, I can't judge if this is what you want.
ps:array 未对齐,先查看array是否对齐,可能是数据集末尾行存在多余行
http://stackoverflow.com/questions/4674473/valueerror-setting-an-array-element-with-a-sequence
http://blog.csdn.net/pipisorry/article/details/23563441
from:http://blog.csdn.net/pipisorry/article/details/48031035
ref:
ValueError: setting an array element with a sequence.的更多相关文章
- sklearn中报错ValueError: Expected 2D array, got 1D array instead:
from sklearn.linear_model import LinearRegression lr = LinearRegression() print(tr_x.shape,tr_y.shap ...
- 决策树python建模中的坑 :ValueError: Expected 2D array, got 1D array instead:
决策树python建模中的坑 代码 #coding=utf-8 from sklearn.feature_extraction import DictVectorizerimport csvfrom ...
- [已解决]报错:ValueError: Expected 2D array, got scalar array instead
报错代码: new_x = 84610 pre_y = model.predict(new_x) print(pre_y) 报错结果: ValueError: Expected 2D array, g ...
- python 使用sk_learn 遇到 问题ValueError: Expected 2D array, got 1D array instead:
这里我找到我的问题是: 使用的是一个新的scikit学习版本,它抛出了一个错误,因为在新版本中,所有东西都必须是一个二维矩阵,甚至是一个列或行. 它甚至说:用数组来重塑你的数据.如果您的数据有一个单独 ...
- Curious Array Codeforces - 407C(高阶差分(?)) || sequence
https://codeforces.com/problemset/problem/407/C (自用,勿看) 手模一下找一找规律,可以发现,对于一个修改(l,r,k),相当于在[l,r]内各位分别加 ...
- tensorflow基本操作(1)
import tensorflow as tf import numpy as np 点乘,支持broadcasting 乘号* 和 multiply等价 mul已经废弃不用了 matmul 是矩阵相 ...
- MindSpore特性支持类
MindSpore特性支持类 Q:请问MindSpore支持梯度截断吗? A:支持,可以参考梯度截断的定义和使用. Q:如何在训练神经网络过程中对计算损失的超参数进行改变? A:暂时还未有这样的功能. ...
- How do I remove a particular element from an array in JavaScript?
9090down voteaccepted Find the index of the array element you want to remove, then remove that index ...
- The Kernel Newbie Corner: Kernel Debugging with proc "Sequence" Files--Part 3
转载:https://www.linux.com/learn/linux-career-center/44184-the-kernel-newbie-corner-kernel-debugging-w ...
随机推荐
- PHP MySQL Order By 关键词
ORDER BY 关键词用于对记录集中的数据进行排序. ORDER BY 关键词 ORDER BY 关键词用于对记录集中的数据进行排序. ORDER BY 关键词默认对记录进行升序排序. 如果你想降序 ...
- Nginx之(二)Nginx安装
首先从官网上http://nginx.org/下载最新的stable version源码,当前最新版本为nginx-1.10.2.tar.gz. 2.1 configure 解压之后,会发现里面有一个 ...
- 解读Batch Normalization
原文转自:http://blog.csdn.net/shuzfan/article/details/50723877 本次所讲的内容为Batch Normalization,简称BN,来源于<B ...
- ViewPager滑动后,可移动的Imageview会回到初始化的位置
知乎看到的原文http://www.zhihu.com/question/37398770?sort=created ViewPager滑动后,可移动的Imageview会回到初始化的位置? < ...
- Redis之(三)管理命令
4.1键管理 通过学习五种数据类型的操作命令,可以发现,Redis对每种数据的处理之前,都要先指定该数据的key,然后再指定对该数据进行何种操作. Redis中的key有点类似于Java中的变量名,起 ...
- proc文件系统探索 之 根目录下的文件[三]
包括对proc根目录下meminfo文件的解析. > cat /proc/meminfo 读出的内核信息进行解释,下篇文章会简单对读出该信息的代码进行简单的分析. MemTotal: 507 ...
- Dynamics CRM Trigger plugin for N:N relationships
博客原文:https://demystifyingcrm.wordpress.com/2014/12/17/trigger-plugin-for-nn-relationships-in-dynamic ...
- rbac 概念
1 权限管理 1.1 什么是权限管理 分享牛原创,分享牛系列.基本上涉及到用户参与的系统都要进行权限管理,权限管理属于系统安全的范畴,权限管理实现对用户访问系统的控制,按照安全规则或者安全策略控制用户 ...
- 理解性能的奥秘——应用程序中慢,SSMS中快(4)——收集解决参数嗅探问题的信息
本文属于<理解性能的奥秘--应用程序中慢,SSMS中快>系列 接上文:理解性能的奥秘--应用程序中慢,SSMS中快(3)--不总是参数嗅探的错 前面已经提到过关于存储过程在SSMS中运行很 ...
- REFRESH删除POSTGRESQL
sudo apt-get install python-psycopg2sudo apt-get install postgresql sudo su - postgres createuser -- ...