title: pandas dataframe binning and grouping
body: <p>I have a data frame with the following content</p>
  
  <pre><code>date                    val
  
  2010-01-01 20:46:15.00  7665
  2010-01-01 20:46:55.20  2878
  2010-01-01 20:47:55.20  8211
  2010-02-12 03:08:03.20  0027
  2010-02-12 03:09:10.07  3319
  2011-04-21 11:46:14.40  3239
  2011-04-21 11:47:08.12  7665
  2012-06-25 12:42:03.09  7750
  2012-06-25 13:38:54.88  7740
  </code></pre>
  
  <p>I want the data to be binned such that I have a new column such that it contains the val which co-appeared during 10 minute duration.  In the above example, it will be like</p>
  
  <pre><code>bin                                   vals_in_bin
  2010-01-01 00:00:00.00 - 00:10:00.00    None
  .
  .
  2010-01-01 20:40:00.00 - 20:50:00.00   7665,2878,8211
  .
  .
  </code></pre>
  
  <p>Then I want to find the Top 10 pairs of vals which co-appears in this new data</p>
  
  <p>For example, if we assume that the vals (7665, 2878, 8211) co-appear in the new data most times, this will result in 3 top co-appearing pairs (7665,2878), (7665, 8211), (2878,8211).  I need to get such pairs corresponding to 10 top co-appearing pairs.</p>
  
  <p>So far, what I succeeded is creating bins as per time.  But I do not know how to group val based on this bins</p>
  
  <pre><code>data = pd.read_csv(file_loc))
  data= data.drop_duplicates()
  data.reindex()
  data['date'] = pd.to_datetime(data['date'])
  start_time = data['date'].min()
  end_time = data['date'].max()
  bins = pd.date_range(start = start_time, end=end_time, freq='10T')
  </code></pre>