title: Using a custom scoring function with pandas groupby to create a column in another dataframe
body: <p>This is my partial df=</p>
  
  <pre><code>dStart         y_test    y_pred
  2018-01-01       1         2
  2018-01-01       2         2
  2018-01-02       3         3
  2018-01-02       1         2
  2018-01-02       2         3
  </code></pre>
  
  <p>I want to create a column in another dataframe (df1) with the Mathews Correlation Coefficient of each unique dStart.</p>
  
  <pre><code>from sklearn.metrics import matthews_corrcoef
  
  def mcc_func(y_test,y_pred):
              return matthews_corrcoef(df[y_test].values,df[y_pred].values)
  df1['mcc']=df.groupby('dStart').apply(mcc_func('y_test','y_pred'))
  </code></pre>
  
  <p>This function doesn't work -- I think because the function returns a float, and 'apply' wants to use the function on the groupby data itself, but I can't figure out how to give the right function to apply.</p>