title: Group list by values
body: <p>Let's say I have a list like this:</p>
  <pre><code>mylist = [[&quot;A&quot;,0], [&quot;B&quot;,1], [&quot;C&quot;,0], [&quot;D&quot;,2], [&quot;E&quot;,2]]
  </code></pre>
  <p>How can I most elegantly group this to get this list output in Python:</p>
  <pre><code>[[&quot;A&quot;, &quot;C&quot;], [&quot;B&quot;], [&quot;D&quot;, &quot;E&quot;]]
  </code></pre>
  <p>So the values are grouped by the secound value but the order is preserved...</p>