title: How to remove the multiindex from GroupBy.apply()?
body: <p>Based off <a href="https://stackoverflow.com/q/46677822/4909087">this question</a>.</p>
  
  <blockquote>
  <pre><code>df = pandas.DataFrame([[2001, "Jack", 77], [2005, "Jack", 44], [2001, "Jill", 93]],columns=['Year','Name','Value'])
  
      Year    Name    Value
  0   2001    Jack    77
  1   2005    Jack    44
  2   2001    Jill    93
  </code></pre>
    
    <p>For each unique Name, I would like to keep the row with the largest
    Year value. In the above example I would like to get the table</p>
  
  <pre><code>    Year    Name    Value
  0   2005    Jack    44
  1   2001    Jill    93
  </code></pre>
  </blockquote>
  
  <p>I tried solving this question with <code>groupby</code> + (<code>apply</code>):</p>
  
  <pre><code>df.groupby('Name', as_index=False)\
       .apply(lambda x: x.sort_values('Value').head(1))
       Year  Name  Value
  0 0  2001  Jack     44
  1 2  2001  Jill     93
  </code></pre>
  
  <p>Not the best approach, but I'm more interested in what is happening, and why. The result has a <code>MultiIndex</code> that looks like this:</p>
  
  <pre><code>MultiIndex(levels=[[0, 1], [0, 2]],
             labels=[[0, 1], [0, 1]])
  </code></pre>
  
  <p>I'm not looking for a workaround. I'm actually more interested to know why this happens, and how I can prevent it without changing my approach.</p>