【发布时间】:2016-09-02 23:49:24
【问题描述】:
我在打印 numpy 3D 矩阵中的列时遇到问题。 这是问题的简化版本:
import numpy as np
Matrix = np.zeros(((10,9,3))) # Creates a 10 x 9 x 3 3D matrix
Matrix[2][2][6] = 578
# I want to print Matrix[2][x][6] for x in range(9)
# the purpose of this is that I want to get all the Values in Matrix[2][x][6]
如果你们能帮助我,不胜感激。 提前致谢。
【问题讨论】:
-
Matrix[2][2][6] = 578给出IndexError,因为您的最后一个维度对于索引6来说不够大。这将工作Matrix[6][2][2] = 578
标签: python numpy matrix multidimensional-array