title: Faster alternative to perform pandas groupby operation
body: <p>I have a dataset with name (person_name), day and color (shirt_color) as columns.</p>
  
  <p>Each person wears a shirt with a certain color on a particular day. The number of days can be arbitrary.</p>
  
  <p>E.g. input:</p>
  
  <pre><code>name  day  color
  ----------------
  John   1   White
  John   2   White
  John   3   Blue
  John   4   Blue
  John   5   White
  Tom    2   White
  Tom    3   Blue
  Tom    4   Blue
  Tom    5   Black
  Jerry  1   Black
  Jerry  2   Black
  Jerry  4   Black
  Jerry  5   White
  </code></pre>
  
  <p>I need to find the most frequently used color by each person.</p>
  
  <p>E.g. result:</p>
  
  <pre><code>name    color
  -------------
  Jerry   Black
  John    White
  Tom     Blue
  </code></pre>
  
  <p>I am performing the following operation to get the results, which works fine but is quite slow:</p>
  
  <pre><code>most_frquent_list = [[name, group.color.mode()[0]] 
                          for name, group in data.groupby('name')]
  most_frquent_df = pd.DataFrame(most_frquent_list, columns=['name', 'color'])
  </code></pre>
  
  <p>Now suppose I have a dataset with 5 million unique names. What is the best/fastest way to perform the above operation?</p>