Python access all entrys from one dimension in a multidimensional numpy array
<p>I would like to manipulate the data of all entries of a complicated 3d numpy array. I want all entries of all subarrays in the X-Y-Position. I know Matlab can do something like that (with the variable indicator : for everything) I indicated that below with DARK[:][1][1]. Which basically mean I want the second entry from the second the column in all sub arrays. Is there a way to do this in python?</p>

<pre><code>import numpy

# Creating a dummy variable of the type I deal with (If this looks crappy sorry, the variable actually comes from the output of d = pyfits.getdata()):
a = []
for i in range(3):
    d = numpy.array([[i, 2*i], [3*i, 4*i]])
    a.append(d)

print a
# Pseudo code:
print 'Second row, second column: ', a[:][1][1]
</code></pre>

<p>I expect a result like this:</p>

<pre><code>[array([[ 0,  0],[ 0,  0]]),
array([[ 1,  2],[ 3,  4]]),
array([[ 2,  4],[ 6,  8]])]

Second row, second column: [0, 4, 8]
</code></pre>

<p>Found the solution, thanks <strong>Divakar</strong> and <strong>eeScott</strong>:</p>

<pre><code>import numpy as np

# Creating a dummy variable of the type I deal with (If this looks crappy sorry, the variable actually comes from the output of d = pyfits.getdata()):
a = []
for i in range(3):
    d = np.array([[i, 2*i], [3*i, 4*i]])
    a.append(d)

# print variable
print np.array(a)
print 'Second row, second column: ', np.array(a)[:, 1, 1]

# Alternative solution:
a = np.asarray(a)
print a
print 'Second row, second column: ', a[:,1,1]
</code></pre>

<p>Result:</p>

<pre><code>[[[0 0][0 0]]
 [[1 2][3 4]]
 [[2 4][6 8]]]
Second row, second column:  [0 4 8]
</code></pre>

python arrays numpy