当前位置:网站首页>Valueerror: invalid literal for int() with base 10 conversion error related to data type
Valueerror: invalid literal for int() with base 10 conversion error related to data type
2022-04-23 20:47:00 【NuerNuer】
1.ValueError: invalid literal for int() with base 10
a Is a string , for example ‘108.8’
Error reason : Direct pair a Conduct int(a) operation , Grammar does not allow
terms of settlement :int(float(a)) or round(float(a)), That is, first convert the string to floating-point data , Then round
2.TypeError: Cannot cast array data from dtype(‘float64‘) to dtype(‘<U32‘)....
Error reason :‘U32’ and ’S32’ All means numpy An array is an array of strings , Not an array of numbers , Therefore, it cannot be directly converted to floating-point array , Be careful ,numpy Array , As long as one item is a string , The types returned by the array are all string arrays .
terms of settlement : take numpy Convert to floating point array , Reference code :
mx = mx.astype(float)
版权声明
本文为[NuerNuer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210545523170.html
边栏推荐
- LeetCode 74、搜索二维矩阵
- SQL: query duplicate data and delete duplicate data
- Unity animation creates sequence frame code and generates animationclip
- Preliminary understanding of cache elimination algorithm (LRU and LFU)
- 缓存淘汰算法初步认识(LRU和LFU)
- [matlab 2016 use mex command to find editor visual studio 2019]
- 中创存储|想要一个好用的分布式存储云盘,到底该怎么选
- LeetCode 1351、统计有序矩阵中的负数
- Cmake project under vs2019: calculating binocular parallax using elas method
- 笔记本电脑卡顿怎么办?教你一键重装系统让电脑“复活”
猜你喜欢
缓存淘汰算法初步认识(LRU和LFU)
Leetcode 542, 01 matrix
[PTA] l1-002 printing hourglass
Vscode download speed up
GO语言开发天天生鲜项目第三天 案例-新闻发布系统二
Elastic box model
MySQL basic collection
LeetCode 116. Populate the next right node pointer for each node
GSI-ECM工程建设管理数字化平台
Case of the third day of go language development fresh every day project - news release system II
随机推荐
LeetCode 116. 填充每个节点的下一个右侧节点指针
3-5 obtaining cookies through XSS and the use of XSS background management system
Solution: NPM err! code ELIFECYCLE npm ERR! errno 1
Introduction to intrusion detection data set
Imitation Baidu map realizes the three buttons to switch the map mode by automatically shrinking the bottom
內網滲透之DOS命令
Fastdfs mind map
学会打字后的思考
Case of the third day of go language development fresh every day project - news release system II
MySQL basic collection
内网渗透之DOS命令
bounding box iou
浅谈数据库设计之三大范式
GSI-ECM工程建设管理数字化平台
On the three paradigms of database design
Leetcode 1337. Row K with the weakest combat effectiveness in the matrix
Elastic box model
[matlab 2016 use mex command to find editor visual studio 2019]
Come in and teach you how to solve the problem of port occupation
Cmake project under vs2019: calculating binocular parallax using elas method