title: Choose between two values and set the most frequent in a pandas dataframe
body: <p>I've asked a <a href="https://stackoverflow.com/questions/46201618/pandas-the-best-way-to-create-new-frame-by-specific-criteria">question</a> recently, but now I have a new problem. Here is my DataFrame:</p>
  
  <pre><code>df = pd.DataFrame({'id':[1,1,1,1,2,2,2,3,3,3,4,4],
                'sex': [0,0,0,1,0,0,0,1,1,0,1,1]})
  
      id  sex
  0   1   0
  1   1   0
  2   1   0
  3   1   1
  4   2   0
  5   2   0
  6   2   0
  7   3   1
  8   3   1
  9   3   0
  10  4   1
  11  4   1
  </code></pre>
  
  <p>Now I need to set sex value for id's with mixed sex values. It should be the most frequent value. So i want to get something like this:</p>
  
  <pre><code>    id  sex
  0   1   0
  1   1   0
  2   1   0
  3   1   0
  4   2   0
  5   2   0
  6   2   0
  7   3   1
  8   3   1
  9   3   1
  10  4   1
  11  4   1
  </code></pre>
  
  <p>And after that I want to get only one id - sex pair:</p>
  
  <pre><code>id  sex
  0   1   0
  1   2   0
  2   3   1
  3   4   1
  </code></pre>