当前位置:网站首页>解决numpy.core._exceptions.UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matchin问题
解决numpy.core._exceptions.UFuncTypeError: ufunc ‘add‘ did not contain a loop with signature matchin问题
2022-06-30 12:03:00 【全栈程序员站长】
最近在测试分销的项目,每次手动计算分销员的佣金,感觉特别麻烦,所以想着用 python 来实现自动计算佣金,但是在计算过程中遇到一个问题,如下:
问题描述
如图,在佣金矩阵计算相加的时候, numpy 抛了一个异常,这个异常在网上也没有找到相关资料。
于是我打断点看了一下,发现在计算的时候, list 中的数据,返回的是 str 类型,导致矩阵相加的时候,计算失败了。
然后我又去看了一下自己写的佣金计算规则的代码,需求中有个如果佣金金额大于两位小数的时候,会将数据四舍五入保留两位小数,但是保留两位小数数据类型就变成 str 类型了,然后我将数据类型转成 float,问题就处理啦~如图:
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/100687.html原文链接:https://javaforall.cn
边栏推荐
- Redis cache problem
- MySQL中变量的定义和变量的赋值使用
- Building a database model using power designer tools
- ZABBIX monitors the number of TCP connections
- Redis - problèmes de cache
- 1254. 统计封闭岛屿的数目
- Conference Preview - Huawei 2012 lab global software technology summit - European session
- iServer发布ES服务查询设置最大返回数量
- Redis installation on Linux system
- edusoho企培版纯内网部署教程(解决播放器,上传,后台卡顿问题)
猜你喜欢

Openmldb meetup No.4 meeting minutes

STM32 porting the fish component of RT thread Standard Edition

Redis-緩存問題

Redis的配置文件及新数据类型

Redis的基本操作的命令

Introduction to new features of ES6

qt msvc 安装及调试

Building of Hisilicon 3559 universal platform: obtaining the modified code of data frame

How difficult is data governance and data innovation?

Browser plays RTSP video based on nodejs
随机推荐
Linux系统Redis的安装
200. 岛屿数量
Swagger2自动生成APi文档
[cloud native | kubernetes] in depth understanding of deployment (VIII)
Use of redis in projects
60 个神级 VS Code 插件!!
695.最大岛屿面积
视频按每100帧存一个文件夹,处理完再图片转视频
两批次纯牛奶不合格?麦趣尔回应:正对产品大批量排查抽检
What is the principle of spectral confocal displacement sensor? Which fields can be applied?
Redis installation on Linux system
Redis - problèmes de cache
Four Misunderstandings of Internet Marketing
1175. prime number arrangement: application of multiplication principle
90. (cesium chapter) cesium high level listening events
8253计数器介绍
Hisilicon 3559 sample parsing: Venc
海思3559万能平台搭建:获取数据帧修改后编码
移除无效的括号[用数组模拟栈]
Mysql中 begin..end使用遇到的坑