title: The result of dataframe.mean() is incorrect
body: <p>I am workint in Python 2.7 and I have a data frame and I want to get the average of the column called 'c', but only the rows that verify that the values in another column are equal to some value.
  When I execute the code, the answer is unexpected, but when I execute the calculation, calculating the median, the result is correct.</p>
  
  <p>Why is the output of the mean incorrect?</p>
  
  <p>The code is the following:</p>
  
  <pre class="lang-py prettyprint-override"><code>df = pd.DataFrame(
      np.array([['A', 1, 2, 3], ['A', 4, 5, np.nan], ['A', 7, 8, 9], ['B', 3, 2, np.nan], ['B', 5, 6, np.nan], ['B',5, 6, np.nan]]), 
      columns=['a', 'b', 'c', 'd']
  )
  </code></pre>
  
  <pre class="lang-py prettyprint-override"><code>df
  mean1 = df[df.a == 'A'].c.mean()
  mean2 = df[df.a == 'B'].c.mean()
  
  median1 = df[df.a == 'A'].c.median()
  median2 = df[df.a == 'B'].c.median()
  </code></pre>
  
  <p>The output:</p>
  
  <pre class="lang-py prettyprint-override"><code>df
  Out[1]: 
     a  b  c    d
  0  A  1  2    3
  1  A  4  5  nan
  2  A  7  8    9
  3  B  3  2  nan
  4  B  5  6  nan
  5  B  5  6  nan
  </code></pre>
  
  <pre class="lang-py prettyprint-override"><code>mean1
  Out[2]: 86.0
  
  mean2
  Out[3]: 88.66666666666667
  
  median1
  Out[4]: 5.0
  
  median2
  Out[5]: 6.0
  </code></pre>
  
  <p>It is obvious that the output of the mean is incorrect.</p>
  
  <p>Thanks.</p>