[报错]ufunc ‘add‘ did not contain a loop with signature matching types (dtype(‘<U32‘), dtype(‘<U32‘))
报错类型:
ufunc 'add' did not contain a loop with signature matching types (dtype('<U32'), dtype('<U32')) -> dtype('<U32')
- 'add’函数是我自定义的加法函数
- 该错误类型翻译后为:ufunc ‘add’ 不包含具有签名匹配类型的循环
- 查看其它人的错误原因,大部分是由于 数据类型不匹配的原因
- 如下add 函数,当x为int类型,y为str类型的时候,就会出现此种报错。
def add(x,y):print(type(x))print(type(y))return x+y
因此,我在add函数中增加了查看数据类型的函数,发现数据类型为:
<class 'numpy.float64'>
<class 'list'>
这让我很迷惑,我又重新仔细检查了我的函数
df1["property_grid"]=df1[["wgs84_lon","wgs84_lat"]].apply(lambda x: add( x["wgs84_lon"], ["wgs84_lat"]),axis=1)
发现少写了一个x.正确如下:
df1["property_grid"]=df1[["wgs84_lon","wgs84_lat"]].apply(lambda x: add( x["wgs84_lon"], x["wgs84_lat"]),axis=1)
完美解决~
[报错]ufunc ‘add‘ did not contain a loop with signature matching types (dtype(‘<U32‘), dtype(‘<U32‘))相关推荐
- UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matching types (dtype(‘<U14‘), dty
报错信息: UFuncTypeError: ufunc 'add' did not contain a loop with signature matching types (dtype('<U ...
- numpy.core._exceptions.UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matching ty
numpy数组抛出异常:numpy.core._exceptions.UFuncTypeError: ufunc 'add' did not contain a loop with signature ...
- AutoFeat:ufunc ‘_lambdifygenerated‘ did not contain a loop with signature matching types
AutoFeat 特征工程 在尝试利用autofeat生成特征并筛选的过程中报错,目前没有较好的修复 报错信息:UFuncTypeError: ufunc '_lambdifygenerated' d ...
- python TypeError: ufunc 'subtract' did not contain a loop with signature matching types dtype('S32')
参考: TypeError: ufunc 'add' did not contain a loop with signature matching types: http://stackoverflo ...
- TypeError: ufunc ‘multiply‘ did not contain a loop with signature matching types dtype(‘S32‘) dtype(
目录 错误: 解决: 错误: TypeError: ufunc 'multiply' did not contain a loop with signature matching types dtyp ...
- ufunc ‘multiply‘ did not contain a loop with signature matching types (dtype(‘<U32‘), dtype(‘<U32‘))
ufunc 'multiply'不包含签名匹配类型的循环(dtype('<U32'), dtype('<U32')) ->dtype (' & lt; U32 ') 出现这个 ...
- TypeError: ufunc 'multiply' did not contain a loop with signature matching types dtype('S32')
今天拿python写AdaBoost的时候碰到的,一看报错提示就知道是类型错误,后来参考了 http://hyry.dip.jp/tech/book/page/scipy/numpy_ndarray. ...
- ufunc ‘multiply‘ did not contain a loop with signature matching types(dtype(‘<U32‘),dtype(‘<U32‘))
错误原因:1.两个ndarray,一个是32位,一个是64位 2.字符串类型的数据和float类型的数据相乘 修改方案:1.一致改为32位 2.字符串类型改为float类型
- TypeError: ufunc did not contain a loop with signature matching types dtype('U32')
原因:object类型和int类型相加减 解决方法: 此时的object类型可能是'12.3'这样str格式的数字,如果要运算必须进行格式转换: 可采用如下方法(pd.to_numeric()): ...
最新文章
- 神经网络 | 单层感知器从0到1(附Python源代码)
- 从网上批量下载图片并重命名
- CCNA试验-1标准acl
- OpenResty+Lua+redis+mysql实现高性能高可用限流缓存
- Docker安装RabbitMQ(docker-compose.yml)
- 面试题解(4):求排列、组合
- 12bit的图像如何向8bit转化_干货分享 | 如何鉴别Western Blot图像的真实性?
- Linux下的date命令
- python类方法_Python类方法
- Xshell和Xftp免费版下载安装
- 过年了,没买到票的可以过来看一看,12306抢票助手
- 海康SDK数据类型转java
- [转]在WPF中打开网页方法总结
- 数学建模计算机部分知识,数学建模计算机知识的应用
- 网页设计css入门,网页设计基础:Div+CSS布局入门教程
- Mybatis-plus 之sql注入器
- html div自动换行代码,css自动换行_css
- 全国计算机等级考试二级Python(2021年9月)备考笔记 第十二天
- 点滴记录,与技术无关
- c语言int型是什么意思,在c语言中,int代表什么意思
热门文章
- 全面提升易用性:OpenClusterManagement 0.7 版本发布
- 消除失调电压的高手--超级伺服电路
- android电量显示,Android显示电量——自定义电池View
- 树莓派 触摸屏_树莓派加装3.5寸触摸屏方法和触摸屏问题处理
- java计算机毕业设计ssm基于web的教学资源管理系统01jkz(附源码、数据库)
- 3、Modbus通讯协议详解
- 主食应为主少吃饭多吃菜是误区
- 如何在Windows终端中更改文本颜色
- BugPhobia开发篇章:绩效管理的层次优化
- 企业标准化产线建设_中铁十四局集团第一工程发展有限公司 公司新闻 强化示范引领,不断推进建家建线规范化、标准化、细致化————一公司建家建线标准化观摩会在青岛新机场项目部召开...