title: get "1" for a one-dimensional numpy.array using a shape-like function
body: <p>In a function, I give a Numpy array : It can be multi-dimentional but also one-dimentional</p>
  
  <p>So when I give a multi-dimentional array :</p>
  
  <pre><code>np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12]]).shape
  &gt;&gt;&gt; (3, 4)
  </code></pre>
  
  <p>and     </p>
  
  <pre><code>np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12]]).shape[1]
  &gt;&gt;&gt; 4
  </code></pre>
  
  <p>Fine.</p>
  
  <p>But when I ask the shape of</p>
  
  <pre><code>np.array([1,2,3,4]).shape
  &gt;&gt;&gt; (4,)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>np.array([1,2,3,4]).shape[1]
  &gt;&gt;&gt; IndexError: tuple index out of range
  </code></pre>
  
  <p>Ooops, the tuple contain only one element... while I want <code>1</code> to indicate it is a one-dimentional array.
  Is there a way to get this ? I mean with a simple function or method, and without a discriminant test with <code>ndim</code> for exemple ?</p>
  
  <p>Thanks !</p>