numpy 3 dimension array middle indexing bug
<p>I seems found a bug when I'm using python 2.7 with numpy module:</p>

<pre><code>import numpy as np
x=np.arange(3*4*5).reshape(3,4,5)
x
</code></pre>

<p>Here I got the full 'x' array as follows:</p>

<pre><code>array([[[ 0,  1,  2,  3,  4],
        [ 5,  6,  7,  8,  9],
        [10, 11, 12, 13, 14],
        [15, 16, 17, 18, 19]],

       [[20, 21, 22, 23, 24],
        [25, 26, 27, 28, 29],
        [30, 31, 32, 33, 34],
        [35, 36, 37, 38, 39]],

       [[40, 41, 42, 43, 44],
        [45, 46, 47, 48, 49],
        [50, 51, 52, 53, 54],
        [55, 56, 57, 58, 59]]])
</code></pre>

<p>Then I try to indexing single row values in sheet [1]:</p>

<pre><code>x[1][0][:]
</code></pre>

<p>Result:</p>

<pre><code>array([20, 21, 22, 23, 24])
</code></pre>

<p>But something wrong while I was try to indexing single column in sheet [1]:</p>

<pre><code>x[1][:][0]
</code></pre>

<p>Result still be the same as previous:</p>

<pre><code>array([20, 21, 22, 23, 24])
</code></pre>

<p>Should it be array([20, 25, 30, 35])??</p>

<p>It seems something wrong while indexing the middle index with range?</p>

<p>No, it's not a bug.</p>

<p>When you use <code>[:]</code> you are using <a class='doc-link' href="http://stackoverflow.com/documentation/python/289/indexing-and-slicing#t=201608290734003933874">slicing</a> notation and it takes all the list:</p>

<pre><code>l = ["a", "b", "c"]
l[:]
#output:
["a", "b", "c"]
</code></pre>

<p>and in your case:</p>

<pre><code>x[1][:]
#output:
array([[20, 21, 22, 23, 24],
       [25, 26, 27, 28, 29],
       [30, 31, 32, 33, 34],
       [35, 36, 37, 38, 39]])
</code></pre>

<p>What you realy wish is using numpy <code>indexing</code> notation:</p>

<pre><code>x[1, : ,0]
#output:
array([20, 25, 30, 35])
</code></pre>

python arrays numpy