title: difference between A[0] and A[0:1] numpy arrays in python
body: <p>I have a numpy array like this:</p>
  
  <pre><code>candidates = 
  
  array([[1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0,
          0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0],
         [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
          0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1],
         [1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0,
          0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0]])
  </code></pre>
  
  <p>And I do not understand what is the difference between <code>candidates[0]</code>:</p>
  
  <pre><code>candidates[0] = 
  
  array([1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0,
         0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0]
  
  candidates[0].shape = (34,)
  </code></pre>
  
  <p>And <code>candidates[0:1]</code>:</p>
  
  <pre><code>candidates[0:1] = 
  
  array([[1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0,
          0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0]])
  
  candidates[0:1].shape = (1, 34)
  </code></pre>
  
  <p>because I believe the two should give the exact same results? I mean the later i.e. <code>candidates[0:1]</code> is supposed to represent the first element only, right? So, what is the difference between the two exactly?</p>