numpy之ndenumerate,ndindex

#################numpy数组的枚举相当于什么? (★★☆) Z = np.arange(9).reshape(3,3) print('Z=\n',Z) print(Z.shape) for index, value in np.ndenumerate(Z): print('zzzzzzzzzz\n',index, value) print('----------------------') for index in np.ndindex(Z.shape): print(index, Z[index]) # print(help(np.ndenumerate)) print("----------------------") # print(help(np.ndindex)) for index in np.ndindex(3, 2, 2): print(index)

【numpy之ndenumerate,ndindex】

    推荐阅读