title: Monthly correlations of daily data between two pandas DataFrames
body: <p>I have two pandas DataFrames of daily data:</p>
  
  <pre><code>import pandas as pd
  dates = pd.date_range('2016-01-01', '2018-01-01')
  ndays = len(dates)
  df1 = pd.DataFrame(np.random.rand(ndays, 3), columns=['a','b','c'], index=dates)
  df2 = pd.DataFrame(np.random.rand(ndays, 3), columns=['a','b','c'], index=dates)
  </code></pre>
  
  <p>I would like to take the correlation of the values in each dataframe in non-overlapping monthly segments.  The return value should be a DataFrame indexed by month, with columns ['a','b','c'], where each value is the correlation of daily values in df1 and df2 for that calendar month.</p>
  
  <p>I can perform this calculation looping over columns and months, but that does not sound like how a panda would do it.  Is there a way to split two dataframes based on calendar month, apply a correlation between them, and combine into a single dataframe?</p>