当前位置:网站首页>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
边栏推荐
- GO语言开发天天生鲜项目第三天 案例-新闻发布系统二
- MySQL basic collection
- wait、waitpid
- Factory mode
- On IRP from the perspective of source code
- The more you use the computer, the slower it will be? Recovery method of file accidental deletion
- On the three paradigms of database design
- mmap、munmap
- [PTA] l2-011 play with binary tree
- Win 11K in 100 days, super complete learning guide for job transfer test
猜你喜欢

Latex formula

Addition, deletion, modification and query of MySQL advanced table

Matlab: psychtoolbox installation

Go language development Daily Fresh Project Day 3 Case - Press Release System II

MySQL基础之写表(创建表)

Preliminary understanding of cache elimination algorithm (LRU and LFU)

LeetCode 542、01 矩阵

Addition, deletion, modification and query of advanced MySQL data (DML)

内网渗透之DOS命令

Zhongchuang storage | how to choose a useful distributed storage cloud disk
随机推荐
Write table of MySQL Foundation (create table)
IOT 设计与开发
Install MySQL 5.0 under Linux 64bit 6 - the root password cannot be modified
JS arrow function user and processing method of converting arrow function into ordinary function
Commande dos pour la pénétration de l'Intranet
又一款数据分析神器:Polars 真的很强大
setInterval、setTimeout、requestAnimationFrame
Leetcode 1351. Negative numbers in statistical ordered matrices
unity 功能扩展
Common commands of MySQL in Linux
Psychological formula for converting RGB to gray value
Express③(使用Express编写接口、跨域有关问题)
GSI-ECM工程建设管理数字化平台
6-5 string - 2 String copy (assignment) (10 points) the C language standard function library includes the strcpy function for string copy (assignment). As an exercise, we write a function with the sam
LeetCode 74、搜索二维矩阵
Solution: NPM err! code ELIFECYCLE npm ERR! errno 1
Matlab: psychtoolbox installation
Gsi-ecm digital platform for engineering construction management
一些接地气的话儿
2021-06-29 C escape character cancellation and use