当前位置:网站首页>IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boo
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boo
2022-08-02 03:21:00 【woshicaiji12138】
max0=max(val[i][0],val[i][1])
min0=min(val[i][0],val[i][1])
high[min0]=h+x
high[max0]=h+x
今天刷题时上述代码出现如下错误:
IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices
原因是索引Index不能用浮点数,应该改为整型:
max0=int(max(val[i][0],val[i][1]))
min0=int(min(val[i][0],val[i][1]))
high[min0]=h+x
high[max0]=h+x
边栏推荐
猜你喜欢
随机推荐
青蛙跳台阶:我如何得知它是一道斐波那契数列题?——应用题破题“三板斧”
Scaffolding installation
磷脂-聚乙二醇-酰肼,DSPE-PEG-Hydrazide,DSPE-PEG-HZ,MW:5000
基于优化的多核局部费舍尔判别分析的故障分类
[详解C语言]一文带你玩转C语言小游戏---三子棋
A senior test engineer asked me these questions as soon as the interview came
一种基于行为空间的回声状态网络参数优化方法
DOM destruction and reproduction experiment
MySQL8.0与MySQL5.7差异分析
基于libmodbus库实现modbus TCP/RTU通信
LeetCode:1161. 最大层内元素和【BFS层序遍历】
弹性盒子flex属性
「PHP基础知识」空值(null)的使用
2022.7.30 js笔记 运算符和流程控制符、循环
(Reposted) The relationship between hashcode and equals
bgp机房的动态路由和静态路由的区别
Mysql8创建用户以及赋权操作
【C语言万字长文】 宏定义 结构体 共用体 内存对齐知识点总结
Redis笔记基础篇:6分钟看完Redis的八种数据类型
mysql创建表









