Slicing a numpy 3-d matrix into 2-d matrix
I have a 3d numpy matrix t as follows, generated randomly:

t = np.random.rand(2,2,2)
array([[[ 0.80351862,  0.25631294],
        [ 0.7971346 ,  0.29468456]],

       [[ 0.33771957,  0.91776256],
        [ 0.6018604 ,  0.55290615]]])


I want to extract a 2-d matrix such that the result is sliced along the columns of the 3-d matrix. Something like:

array([[ 0.25631294  ,  0.91776256],
       [ 0.29468456,  0.55290615]])


How can I slice in such a way?

Thanks for the help.

That's just taking the last dim, with a transpose:

&gt;&gt;&gt; t[:,:,1].T
array([[ 0.25631294,  0.91776256],
       [ 0.29468456,  0.55290615]])

