title: What is the Python list or NumPy equivalent of Excel's SUMIF function?
body: <p>I have a 2D array:</p>
  
  <pre><code>expenses = np.array([['jim', 'sam', 'bill', 'sam'],[1,2,6,5]])
  </code></pre>
  
  <p>I want to know the total expenses for each unique person in a new array without hardcoding any names (real list is very long) so that I get an output like this:</p>
  
  <pre><code>totals = [['jim', 'sam', 'bill'],[1,7,6]]
  </code></pre>
  
  <p>Is there a way of doing this with a list or NumPy? I don't want to use Pandas for this.</p>
  
  <p>Thanks in advance!</p>