title: How do I create pairs from a data frame given constraints found in another column?
body: <p>I need to randomly match two staff emails from a list of emails. The staff pairs <strong>can not</strong> have the same managers and <strong>can not</strong> have been paired before. Best way to go about achieving this? I'm not that great with Python so not even sure how to start. The other similar questions I found didn't help me much.</p>
  
  <p>I have two datasets:</p>
  
  <ol>
  <li><p>List of active members
  Column A: Emails of staff
  Column B: The staff's manager</p>
  
  <pre><code>Emails             Managers
  jessica@xyz.com    Bob
  alex@xyz.com       Justin
  lucy@xyz.com       Justin
  eric@xyz.com       Zach
  brandon@xyz.com    Tony
  dylan@xyz.com      Patty
  </code></pre></li>
  <li><p>List of historical matches</p>
  
  <pre><code>Emails             Managers
  lucy@xyz.com       Justin
  eric@xyz.com       Zach
  </code></pre></li>
  </ol>
  
  <p>What it might look like:</p>
  
  <pre><code>    Emails1            Managers1    Emails2            Managers2
      dylan@xyz.com      Patty        lucy@xyz.com       Justin
      eric@xyz.com       Zach         brandon@xyz.com    Tony
      ...
  </code></pre>
  
  <p>What I have so far (lol):</p>
  
  <pre><code># Dependencies and Setup
  import pandas as pd
  import numpy as np
  import itertools
  
  # Load file and read in the data
  active_data = pd.read_csv("Active.csv")
  historical_data = pd.read_csv("Historical.csv")
  
  # Preview data
  active_data.head(7)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/i9SgH.jpg" rel="nofollow noreferrer">traceback</a></p>
  
  <p><a href="https://i.stack.imgur.com/FKdte.jpg" rel="nofollow noreferrer">dtypes</a></p>