ValueError: setting an array element with a sequence.
2015-08-27 17:31
453 查看
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
or
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:
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:
Without knowing what your code shall accomplish, I can't judge if this is what you want.
皮皮Blog
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:
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.
皮皮Blog
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.
- 如何访问UITextField内的值
- pcDUino 卡刷实现
- HBuilder快捷键
- 【UISlider滑动控件】
- UISearchBar修改输入框,取消按钮样式
- WM_QUIT,WM_CLOSE,WM_DESTROY
- 理解 Android Build 系统
- 截屏实现,将UIView指定区域转换成图UIImage
- Hadoop 管理工具HUE配置-Hive配置
- Query String模块处理URL中的查询字符串
- 深入学习NSOperationQueue
- 对比MIUI7和Flyme4.5 期待神秘的Flyme5
- quick-3.5 ActionTimeline的setLastFrameCallFunc调用会崩溃问题
- UIImageView多张图片切换
- NGUI基本使用之UISlider事件响应
- Qt for Mac:发布程序(widgets和quick2)
- CSS3使用@Media Query实现响应布局
- uitextfield 偶尔无法选中问题解决办法
- android studio 多渠道打包,调试正式包,build.gradle解析