title: NumPy replace values with arrays based on conditions
body: <p>I am trying to produce a sorter that, for each weekly total (for multiple different products), places them in the right buckets based on the max cumulative allowable less what has already been sorted.</p>
  
  <pre><code>maxes=np.array([100,200,300],[100,400,900])
  weeklytotals=np.array([100,150,200,250],[200,400,600,800)]
  </code></pre>
  
  <p>The desired output would be:</p>
  
  <pre><code>result=np.array([[100,0,0],[100,50,0],[100,100,0],[100,150,0]],[[100,100,0],[100,300,0],[100,400,100],[100,400,300]]
  </code></pre>
  
  <p>I do not want to use loops but I am racking my mind on how to avoid that method. Thanks in advance, still a Python beginner. I want to use NumPy because the end implementation will need to be extremely fast.</p>