当前位置:网站首页>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
边栏推荐
- C migration project record: modify namespace and folder name
- Win 11K in 100 days, super complete learning guide for job transfer test
- LeetCode-279-完全平方数
- What about laptop Caton? Teach you to reinstall the system with one click to "revive" the computer
- unity 功能扩展
- go reflect
- Fastdfs思维导图
- go struct
- MySQL进阶之表的增删改查
- Commande dos pour la pénétration de l'Intranet
猜你喜欢
Latex formula
Express③(使用Express编写接口、跨域有关问题)
vulnhub DC:1渗透笔记
C migration project record: modify namespace and folder name
Identifier CV is not defined in opencv4_ CAP_ PROP_ FPS; CV_ CAP_ PROP_ FRAME_ COUNT; CV_ CAP_ PROP_ POS_ Frames problem
GO语言开发天天生鲜项目第三天 案例-新闻发布系统二
Addition, deletion, modification and query of MySQL advanced table
Win 11K in 100 days, super complete learning guide for job transfer test
On IRP from the perspective of source code
Another data analysis artifact: Polaris is really powerful
随机推荐
Leetcode 1337. Row K with the weakest combat effectiveness in the matrix
Write table of MySQL Foundation (create table)
GSI-ECM工程建设管理数字化平台
内网渗透之DOS命令
MySQL 存储过程和函数
Come in and teach you how to solve the problem of port occupation
go defer
GO語言開發天天生鮮項目第三天 案例-新聞發布系統二
Send email to laravel
3-5通过XSS获取cookie以及XSS后台管理系统的使用
Latex formula
unity 功能扩展
MySQL stored procedures and functions
Commande dos pour la pénétration de l'Intranet
Leetcode 542, 01 matrix
Go zero framework database avoidance Guide
Gsi-ecm digital platform for engineering construction management
Selenium displays webdriverwait
[PTA] l1-002 printing hourglass
Leetcode-279-complete square number