title: aggregation with indices not present in dataframe
body: <pre><code>df = pd.DataFrame({'x':[1,2,3,4,5,6],'y':[7,8,9,10,11,12],'z':['a','a','a','b','b','b']})
  i = pd.Index([0,3,5,10,20])
  </code></pre>
  
  <p>The indices in <code>i</code> are from a larger dataframe, and <code>df</code> is a subset of that larger dataframe. So there will be indices in <code>i</code> that will not be in <code>df</code>. When I do</p>
  
  <pre><code>df.groupby('z').aggregate({'y':lambda x: sum(x.loc[i])}) #I know I can just use .aggregate({'y':sum}), this is just an example to illustrate my problem
  </code></pre>
  
  <p>I get this output </p>
  
  <pre><code>   y
  z    
  a NaN
  b NaN
  </code></pre>
  
  <p>as well as a warning message</p>
  
  <pre><code>__main__:1: FutureWarning: 
  Passing list-likes to .loc or [] with any missing label will raise
  KeyError in the future, you can use .reindex() as an alternative.
  </code></pre>
  
  <p>How can I avoid this warning message and get the correct output? In my example the only valid indices for <code>df</code> are <code>[0,3,5]</code> so the expected output is:</p>
  
  <pre><code>   y
  z    
  a  7 #"sum" of index 0 
  b  22 #sum of index [3,5]
  </code></pre>
  
  <p>EDIT</p>
  
  <p>The answers here work great but they do not allow different types of aggregation of <code>x</code> and <code>y</code> columns. For example, let's say I want to sum all elements of <code>x</code>, but for <code>y</code> only sum the elements in index <code>i</code>:</p>
  
  <pre><code>df.groupby('z').aggregate({'x':sum, 'y': lambda x: sum(x.loc[i])})
  </code></pre>
  
  <p>this is the desired output:</p>
  
  <pre><code>   y   x                       
  z    
  a  7   6
  b  22  15
  </code></pre>