小编Joe*_*McG的帖子

访问3D numpy数组的切片

我有一个3D numpy浮点数数组.我不正确地索引数组吗?我想访问片124(索引123),但我看到了这个错误:

>>> arr.shape
(31, 285, 286)
>>> arr[:][123][:]
Runtime error 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
IndexError: index 123 is out of bounds for axis 0 with size 31
Run Code Online (Sandbox Code Playgroud)

这个错误的原因是什么?

python 3d numpy slice

6
推荐指数
2
解决办法
9707
查看次数

标签 统计

3d ×1

numpy ×1

python ×1

slice ×1