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 ...
随机推荐
- freemarker的使用
一:freemarker是什么? freemarker是一个模板引擎,基于定义的模板和数据生成对应的文本(HTML,xml,java等),是一个生成文本的工具. 二:freemarker的使用方法 ( ...
- OpenResty 自定义 access_log 格式
定义access log的format是 Nginx已经提供的功能,有了 ngx_lua 之后就可以更灵活的记录请求相关的信息,而不仅仅拘泥于 Nginx的内置变量了,可以自定义一些格式和变量来存储结 ...
- 安卓高级6 CoordinatorLayout
原作者大神地址:http://blog.csdn.net/huachao1001/article/details/51554608 曾在网上找了一些关于CoordinatorLayout的教程,大部分 ...
- log4j日志记录级别是如何工作?
级别p的级别使用q,在记录日志请求时,如果p>=q启用.这条规则是log4j的核心.它假设级别是有序的.对于标准级别它们关系如下:ALL < DEBUG < INFO < WA ...
- Dubbo框架应用之(三)--Zookeeper注册中心、管理控制台的安装及讲解
我是在linux下使用dubbo-2.3.3以上版本的zookeeper注册中心客户端.Zookeeper是Apache Hadoop的子项目,强度相对较好,建议生产环境使用该注册中心.Dubbo未对 ...
- MVP框架 – Ted Mosby的软件架构
作者:Hannes Dorfmann 原文链接 : Ted Mosby – Software Architect 文章出自 : Android开发技术前线 译者 : Mr.Simple 我给这篇关于A ...
- Android图表库MPAndroidChart(十四)——在ListView种使用相同的图表
Android图表库MPAndroidChart(十四)--在ListView种使用相同的图表 各位好久不见,最近挺忙的,所有博客更新的比较少,这里今天说个比较简单的图表,那就是在ListView中使 ...
- 剑指offer-面试题7:俩个栈实现队列(java)
详细分析请参照C语言版,这里仅仅给出实现代码,注释很详细,不得不说java各种api用起来真是爽飞了 1 package com.xsf.SordForOffer; 2 3 import java.u ...
- Afinal加载网络图片及下载文件使用方法
Afinal快速开发框架使用起来非常方便,下面将讲解如何利用Afinal加载网络图片及下载文件: 先看效果图: 注意:使用Afinal前需添加Afinal的jar,可以在这里下载:http://dow ...
- introduction of velocity
一.velocity 简介 基于java 的模板引擎,apache 旗下的开源软件项目. 目的在于隔离 表示层和业务逻辑层,当然现在做的不仅仅是这些. 二.应用场景 web 应用程序:创建html页面 ...