当前位置:网站首页>解决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
边栏推荐
- Tencent two sides: @bean and @component are used on the same class. What happens?
- Lvgl widget styles
- Hisilicon 3559 developing common sense reserves: a complete explanation of related terms
- MATLAB中polarplot函数使用
- 剑指 Offer 05. 替换空格: 把字符串 s 中的每个空格替换成“%20“
- The website with id 0 that was requested wasn‘t found. Verify the website and try again
- Four Misunderstandings of Internet Marketing
- Swagger2自动生成APi文档
- 海思3559开发常识储备:相关名词全解
- 3D视觉检测在生产流水的应用有哪些
猜你喜欢

Biological network analysis using deep learning

Redis configuration files and new data types

海思3559萬能平臺搭建:獲取數據幀修改後編碼
![Remove invalid parentheses [simulate stack with array]](/img/df/0a2ae5ae40adb833d52b2dddea291b.png)
Remove invalid parentheses [simulate stack with array]

How to use the plug-in mechanism to gracefully encapsulate your request hook

Redis-缓存问题
![移除无效的括号[用数组模拟栈]](/img/df/0a2ae5ae40adb833d52b2dddea291b.png)
移除无效的括号[用数组模拟栈]

AGCO AI frontier promotion (6.30)

List集合

60 divine vs Code plug-ins!!
随机推荐
Lichuang EDA learning notes 10 common connector component identification and passive buzzer driving circuit
Getting started with the go language is simple: go handles XML files
立创 EDA #学习笔记10# | 常用连接器元器件识别 和 无源蜂鸣器驱动电路
Pharmacy management system
Use of polarplot function in MATLAB
8253 counter introduction
Achieve secure data sharing among multiple parties and solve the problem of asymmetric information in Inclusive Finance
A Generic Deep-Learning-Based Approach for Automated Surface Inspection-論文閱讀筆記
Set集合
grep匹配查找
Introduction to new features of ES6
The website with id 0 that was requested wasn‘t found. Verify the website and try again
Swagger2自动生成APi文档
Swagger2 automatically generates API documents
A High-Precision Positioning Approach for Catenary Support Components With Multiscale Difference阅读笔记
200. number of islands
A new journey of the smart court, paperless office, escorting the green trial of the smart court
浏览器播放rtsp视频,基于nodeJs
海思3559万能平台搭建:YUV格式简介
Analysis of the whole process of common tilt data processing in SuperMap idesktop