title: Groupby values of dataframe of columns into JSON
body: <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>class_id</th>
  <th>class</th>
  <th>code</th>
  <th>id</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>8</td>
  <td>XYZ</td>
  <td>A</td>
  <td>1</td>
  </tr>
  <tr>
  <td>8</td>
  <td>XYZ</td>
  <td>B</td>
  <td>2</td>
  </tr>
  <tr>
  <td>9</td>
  <td>ABC</td>
  <td>C</td>
  <td>3</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I have a dataframe like above. I want to transform it so the 'codes' column below collects all the unique (code, id) pairs into a JSON format that a class contains.</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>class_id</th>
  <th>class</th>
  <th>codes</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>8</td>
  <td>XYZ</td>
  <td>[{'code: 'A', 'id': 1}, {'code': 'B', 'id': 2}]</td>
  </tr>
  <tr>
  <td>9</td>
  <td>ABC</td>
  <td>[{'code: 'C', 'id': 3}]</td>
  </tr>
  </tbody>
  </table>
  </div>