title: Removing matching elements from two numpy arrays
body: <p>Consider two sorted <code>numpy</code> arrays:</p>
  
  <pre><code>import numpy as np
  
  a = np.array([1,2,4,4,6,8,10,10,21])
  b = np.array([3,3,4,6,10,18,22])
  </code></pre>
  
  <p>How do I:
  1. Find the elements that appear in both lists, and
  2. Remove only <em>one</em> instance of that occurrence from each list. </p>
  
  <p>That is the output should be:</p>
  
  <pre><code>a = [1,2,4,8,10,21]
  
  b = [3,3,18,22]
  </code></pre>
  
  <p>So even if there are duplicates, only one instance is removed. However if the lists are</p>
  
  <pre><code>c = np.array([1,2,4,4,6,8,10,10,10,21])
  d = np.array([3,3,4,6,10,10,18,22])
  </code></pre>
  
  <p>I expect to obtain the new outputs:</p>
  
  <pre><code>c = [1,2,4,8,10,21]
  
  d = [3,3,18,22]
  </code></pre>
  
  <p>which is the same as above. The difference is the number of 10's in the list. Each of the two 10's in list <code>d</code> takes away one 10 each from <code>c</code> leaving the same result.</p>
  
  <p>This <a href="https://stackoverflow.com/questions/27269476/comparing-two-numpy-arrays-and-removing-elements">post</a> was the closest match to my question, but it removed <em>all</em> instances of repeats from both lists.</p>