title: One-To-Many Merge with Pandas
body: <p>Given two dataframes in which two keys share a centralised value in another dataframe as follows:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">manager_id</th>
  <th style="text-align: center;">employee_id</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">1</td>
  <td style="text-align: center;">5</td>
  </tr>
  <tr>
  <td style="text-align: left;">4</td>
  <td style="text-align: center;">3</td>
  </tr>
  <tr>
  <td style="text-align: left;">4</td>
  <td style="text-align: center;">2</td>
  </tr>
  <tr>
  <td style="text-align: left;">7</td>
  <td style="text-align: center;">9</td>
  </tr>
  </tbody>
  </table>
  </div><div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">employee_id</th>
  <th style="text-align: center;">location</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">1</td>
  <td style="text-align: center;">US</td>
  </tr>
  <tr>
  <td style="text-align: left;">2</td>
  <td style="text-align: center;">France</td>
  </tr>
  <tr>
  <td style="text-align: left;">3</td>
  <td style="text-align: center;">UK</td>
  </tr>
  <tr>
  <td style="text-align: left;">4</td>
  <td style="text-align: center;">Russia</td>
  </tr>
  <tr>
  <td style="text-align: left;">5</td>
  <td style="text-align: center;">Mexico</td>
  </tr>
  <tr>
  <td style="text-align: left;">6</td>
  <td style="text-align: center;">Spain</td>
  </tr>
  <tr>
  <td style="text-align: left;">7</td>
  <td style="text-align: center;">Italy</td>
  </tr>
  <tr>
  <td style="text-align: left;">8</td>
  <td style="text-align: center;">Greece</td>
  </tr>
  <tr>
  <td style="text-align: left;">9</td>
  <td style="text-align: center;">Hungary</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>how to merge with pandas the key in the second dataframe to the other two in the first one so it ends up as follows:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">manager_id</th>
  <th style="text-align: center;">employee_id</th>
  <th style="text-align: center;">manager_location</th>
  <th style="text-align: center;">employee_location</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">1</td>
  <td style="text-align: center;">5</td>
  <td style="text-align: center;">US</td>
  <td style="text-align: center;">Mexico</td>
  </tr>
  <tr>
  <td style="text-align: left;">4</td>
  <td style="text-align: center;">3</td>
  <td style="text-align: center;">Russia</td>
  <td style="text-align: center;">UK</td>
  </tr>
  <tr>
  <td style="text-align: left;">4</td>
  <td style="text-align: center;">2</td>
  <td style="text-align: center;">Russia</td>
  <td style="text-align: center;">France</td>
  </tr>
  <tr>
  <td style="text-align: left;">7</td>
  <td style="text-align: center;">9</td>
  <td style="text-align: center;">Italy</td>
  <td style="text-align: center;">Hungary</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>to be clear, both manager_id and employee_id share the same id key in the location table, even if they have distinct names.</p>
  <p>Thanks in advance.</p>