Selecting a column of a numpy array
<p>I am somewhat confused about selecting a column of an NumPy array, because the result is different from Matlab and even from NumPy matrix. Please see the following cases.</p>

<p>In <strong>Matlab</strong>, we use the following command to select a column vector out of a matrix.</p>

<pre><code>x = [0, 1; 2 3]
out = x(:, 1)
</code></pre>

<p>Then out becomes <code>[0; 2]</code>, which is a column vector.</p>

<p>To do the same thing with <strong>a NumPy Matrix</strong></p>

<pre><code>x = np.matrix([[0, 1], [2, 3]])
out = x[:, 0]
</code></pre>

<p>Then the output is <code>np.matrix([[0], [2]])</code> which is expected, and it is a column vector.</p>

<p>However, in case of <strong>NumPy array</strong></p>

<pre><code>x = np.array([[0, 1], [2, 3]])
out = x[:, 0]
</code></pre>

<p>The output is <code>np.array([0, 2])</code> which is 1 dimensional, so it is not a column vector. My expectation is it should have been <code>np.array([[0], [2]])</code>.
I have two questions.</p>

<p><strong>1.</strong> <strong>Why is the output from the NumPy array case  different form the NumPy matrix case? This is causing a lot of confusion to me, but I think there might be some reason for this.</strong></p>

<p><strong>2.</strong> <strong>To get a column vector from a 2-Dim NumPy Array, then should I do additional things like expand_dims</strong></p>

<pre><code>x = np.array([[0, 1], [2, 3]])
    out = np.expand_dims(x[:, 0], axis = 1)
</code></pre>