title: How to accumulate an array by index in numpy?
body: <p>I have an array:</p>
  
  <pre><code>a = np.array([0,0,0,0,0,0])
  </code></pre>
  
  <p>I want to add some other array into each index of a, while the index can appear more than one times. I want to get the some of each index. I write:</p>
  
  <pre><code>a[np.array([1,2,2,1,3])] += np.array([1,1,1,1,1])
  </code></pre>
  
  <p>but get a to be:</p>
  
  <pre><code>array([0, 1, 1, 1, 0, 0])
  </code></pre>
  
  <p>But what I want is to get:</p>
  
  <pre><code>array([0, 2, 2, 1, 0, 0])
  </code></pre>
  
  <p>How to implement this in numpy without for loop?</p>