title: Filtering, grouping data
body: <pre><code>PROT      PEP       SD  
  1        XXX      4,54             
  1        XXX      5,56             
  1        XXY      4,67                       
  1        XXZ      5,67             
  1        XXY      5,67  
  1        XXX      5,68          
  2        XXW      4,64             
  2        XXZ      4,54             
  2        XXW      5,56             
  2        XXX      4,67                        
  2        XXX      5,67  
  </code></pre>
  
  <p>I need to figure out a way of filtering data by prot and pep but keeping only pep where there is more than 1 pep for prot -> and then filter again so for every pep values only 2 with the highest SD remain (and sum these two / divide by 2)</p>
  
  <p>Output for PROT1:</p>
  
  <pre><code>PROT    PEP   SD
  1       XXX   5.56+5.68 /2
          XXY   4.67 + 5.67 /2
  </code></pre>
  
  <p>I think this may be the way if I figure out what to put after lambda x: so it takes three top values, right now it's giving me one top value index.</p>
  
  <pre><code>counts = (df6.groupby(['PROT','PEP])['SD']
          .apply(lambda x: x.idxmax()))
  </code></pre>