当前位置:网站首页>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
边栏推荐
- (Reposted) The relationship between hashcode and equals
- LeetCode:第304场周赛【总结】
- 网站与服务器维护怎么做?
- 小程序组件总结
- bgp机房的动态路由和静态路由的区别
- (forwarded) HashCode summary (2)
- 「PHP基础知识」空值(null)的使用
- Mysql8.0安装教程
- Daily practice------There are n integers, so that the previous numbers are moved back m positions in order, and the last m numbers become the first m numbers
- Redis简单学习笔记
猜你喜欢
随机推荐
磷脂-聚乙二醇-叠氮,DSPE-PEG-Azide,DSPE-PEG-N3,MW:5000
考虑饱和的多智能体系统数据驱动双向一致性
MySQL分页查询的5种方法
每日练习------有n个整数,使其前面各数顺序向后移m个位置,最后m个数变成最前面的m个数
离线数仓-用户行为采集
通过PS 2021 将网页图标抠下来
mysql中如何查看表是否被锁
线性代数学习笔记3-1:矩阵与线性变换、常见矩阵(逆矩阵、伴随矩阵、正交矩阵等)
Good Key, Bad Key (thinking, temporary exchange, classic method)
Mysql8.0安装教程
构造方法、方法重载、全局变量与局部变量
自定义mvc框架复习(crud)
基于libmodbus库实现modbus TCP/RTU通信
Scaffolding installation
跨域问题解决
二维数组实战项目--------《三子棋》
【深度学习】从LeNet-5识别手写数字入门深度学习
Webshell upload method
浏览器的工作原理(dns域名服务器,tcp握手,ssl/tls安全协议,关键渲染路径,重绘及回流,防抖和节流)
TRICK second bullet