title: Reverse the group/items in Python
body: <p>I have a table like this:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Group</th>
  <th>Item</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>A</td>
  <td>a, b, c</td>
  </tr>
  <tr>
  <td>B</td>
  <td>b, c, d</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>And I want to convert to like this:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Item</th>
  <th>Group</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>a</td>
  <td>A</td>
  </tr>
  <tr>
  <td>b</td>
  <td>A, B</td>
  </tr>
  <tr>
  <td>c</td>
  <td>A, B</td>
  </tr>
  <tr>
  <td>d</td>
  <td>B</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>What is the best way to achieve this?</p>
  <p>Thank you!!</p>