当前位置:网站首页>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 knowledge
- Plato farm is one of the four largest online IEOS in metauniverse, and the transaction on the chain is quite high
- Elastic box model
- [PTA] l2-011 play with binary tree
- Install MySQL 5.0 under Linux 64bit 6 - the root password cannot be modified
- pikachuxss如何获取cookie靶场,返回首页总是失败
- Psychological formula for converting RGB to gray value
- Learn to C language fourth day
- Leetcode-279-complete square number
- wait、waitpid
猜你喜欢
UnhandledPromiseRejectionwarning:CastError: Cast to ObjectId failed for value
Elastic box model
Unity animation creates sequence frame code and generates animationclip
高薪程序员&面试题精讲系列91之Limit 20000加载很慢怎么解决?如何定位慢SQL?
浅谈数据库设计之三大范式
Common problems in deploying projects with laravel and composer for PHP
go slice
The more you use the computer, the slower it will be? Recovery method of file accidental deletion
Solution: NPM err! code ELIFECYCLE npm ERR! errno 1
Preliminary understanding of cache elimination algorithm (LRU and LFU)
随机推荐
【SQL】字符串系列2:将一个字符串根据特定字符分拆成多行
软件测试要怎么学?自学还是培训看完这篇文章你就懂了
Leetcode 1351. Negative numbers in statistical ordered matrices
wait、waitpid
IOT 设计与开发
Psychological formula for converting RGB to gray value
Linux中,MySQL的常用命令
Case of the third day of go language development fresh every day project - news release system II
[SQL] string series 2: split a string into multiple lines according to specific characters
LeetCode 74、搜索二维矩阵
A login and exit component based on token
An error occurs when the addressable assets system project is packaged. Runtimedata is null
Plato farm is one of the four largest online IEOS in metauniverse, and the transaction on the chain is quite high
高薪程序员&面试题精讲系列91之Limit 20000加载很慢怎么解决?如何定位慢SQL?
mmap、munmap
Latex formula
pikachuxss如何获取cookie靶场,返回首页总是失败
The more you use the computer, the slower it will be? Recovery method of file accidental deletion
C# 知识
LeetCode 542、01 矩阵