title: Combining/merging values in pandas
body: <p>I have multiple values for a single class in a column and I want to combine/merge them. I have tried the following code but it just merges values based on each grade.</p>
  <pre><code>df.groupby('Grades')['Students'].apply(' '.join).reset_index()
  </code></pre>
  <p>I do not want it. Let's assume we have the following DataFrame:</p>
  <pre><code>+----------------------------------+--------+
  |             Students             | Grades |
  +----------------------------------+--------+
  | Student1                         |      0 |
  | Student1                         |      1 |
  | Student1                         |      2 |
  | Student2                         |      3 |
  | Student2                         |      5 |
  | Student2                         |      0 |
  | Student3                         |      1 |
  | Student3                         |      0 |
  | Student3                         |      0 |
  +----------------------------------+--------+
  </code></pre>
  <p>and I want to have the following DataFrame:</p>
  <pre><code>+----------------------------------+--------+
  |             Students             | Grades |
  +----------------------------------+--------+
  | Student1                         |      1 |
  | Student2                         |      3 |
  | Student3                         |      0 |
  +----------------------------------+--------+
  </code></pre>
  <p>where I want to merge students and take one of his/her grades randomly. Even if there are more columns other than grades I want them to be selected randomly for each student when I merge them.</p>