Here is a section of code which is giving me a different answer to what I would expect. The line: print list(x) does what I expect. I would expect the line: print random_array[list(x)] to return the value of that element in the array but it returns three arrays. If for example list(x) returns [9, 8, 7] then random_array[9, :, :], random_array[8, :, :], random_array[7, :, :] will be printed. Can someone please explain to me why this is? And how I can get the expected answer?
import numpy as np
import itertools
random_array = np.random.randint(0, 9, (10, 10, 10))
my_iterator = itertools.product(range(10),range(10),range(10))
for x in my_iterator:
print list(x)
print random_array[list(x)]
random_array[(2,3,3)]